Project

General

Profile

Bug #563

xlc/gcc warnings

Added by Christoph Junghans about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Erik Lindahl
Category:
mdrun
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

@teemu: This warning seem not very important a simple case will fix
"/u/chrj/opt/src/gromacs.stable45/src/src/gmxlib/selection/scanner_internal.c", line 585.46: 1506-280 (W) Function argument assignment between types "char*" and "const char*" is not allowed.
@eric: This one is more serious,
MAXATOMLIST=6 and alc[MAXATOMLIST+1] and alc7 is accessed
MAXATOMLIST should be increased.

"/u/chrj/opt/src/gromacs.stable45/src/src/kernel/toppush.c", line 927.88: 1506-1298 (W) The subscript 7 is out of range. The valid range is 0 to 6.
"/u/chrj/opt/src/gromacs.stable45/src/src/kernel/toppush.c", line 959.28: 1506-1298 (W) The subscript 7 is out of range. The valid range is 0 to 6.
"/u/chrj/opt/src/gromacs.stable45/src/src/kernel/toppush.c", line 959.51: 1506-1298 (W) The subscript 7 is out of range. The valid range is 0 to 6.

I can fix it, but I am not very confident to change somebody else's work ;-)

History

#1 Updated by Teemu Murtola about 9 years ago

(In reply to comment #0)

@teemu: This warning seem not very important a simple case will fix
"/u/chrj/opt/src/gromacs.stable45/src/src/gmxlib/selection/scanner_internal.c",
line 585.46: 1506-280 (W) Function argument assignment between types "char*"
and "const char*" is not allowed.

It seems that Flex only declares the input arguments to several of its functions as 'const' if STDC is defined (or if compiling in C++), and the _gmx_sel_yy_scan_string() called on that line is one of these. So it seems that xlc doesn't define STDC? Does it really claim not to be compatible with C89? We can of course add a cast on that line, but that seems quite inelegant. Or am I misinterpreting the situation? GCC does warn for assignments from const char * to char * as well, but I've never seen such a warning from that part of the code.

#2 Updated by Berk Hess about 9 years ago

No, MAXATOMLIST should not be increased.
I had added one element to the scanf to detect too many parameters.
I have now replaced MAXATOMLIST+1 by MAXATOMLIST+2.
(Note that the last element could only be read with an incorrect top file.)

I won't close the bug because the other issue is not resolved yet.

Berk

#3 Updated by Christoph Junghans about 9 years ago

(In reply to comment #1)

(In reply to comment #0)

@teemu: This warning seem not very important a simple case will fix
"/u/chrj/opt/src/gromacs.stable45/src/src/gmxlib/selection/scanner_internal.c",
line 585.46: 1506-280 (W) Function argument assignment between types "char*"
and "const char*" is not allowed.

It seems that Flex only declares the input arguments to several of its
functions as 'const' if STDC is defined (or if compiling in C++), and the
_gmx_sel_yy_scan_string() called on that line is one of these. So it seems
that xlc doesn't define STDC? Does it really claim not to be compatible
with C89? We can of course add a cast on that line, but that seems quite
inelegant. Or am I misinterpreting the situation? GCC does warn for
assignments from const char * to char * as well, but I've never seen such a
warning from that part of the code.

I think this warning is not to problematic, assignment between types "char*"
and "const char*" is one of these xlc special warning.

Also available in: Atom PDF