This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bootstrap/8710: make bootstrap fails with error on plural.y on AIX 4.3.3


>Number:         8710
>Category:       bootstrap
>Synopsis:       make bootstrap fails with error on plural.y on AIX 4.3.3
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 01:06:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     zvickery@micron.com
>Release:        3.2.1
>Organization:
>Environment:
uname -a: AIX aix41a 3 4 000610534C00
compiler: vacpp.cmp.C 5.0.2.0  VisualAge C++ C Compiler
Using "cc_r" as the bootstrap compiler.
>Description:
When performing make boostrap, the below error appears:
"plural.y", line 264.1: 1506-343 (S) Redeclaration of __gettextlex differs from previous declaration on line 73 of "plural.y".
"plural.y", line 264.1: 1506-381 (I) The type "const unsigned char**" of parameter 2 in the prototype declaration is not compatible with the corresponding parameter type "unsigned char**" in the nonprototype declaration.
make: *** [plural.o] Error 1

I traced this to the below snippet in plural.c:
176  #ifndef __cplusplus
177  #ifndef __STDC__
178  #define const
179  #endif
180  #endif

cc_r and cc by default do not define the __STDC__ symbol, which causes the function definition to have a different signature than the prototype.  Thus causing the error.

I question why this snippet is interposed between the prototype (which declares the second argument as const) and the definition (which defines the second argument based on that ifdef).  Any system that needs to undefine const here will likely be broken.  
>How-To-Repeat:
On my build system, unpacking the gcc source, running configure and make bootstrap reproduces the error every time.  This is the only system I have with a compiler available, so I  have not attempted a build on any other AIX systems.
>Fix:
The best way to eliminate this particular error is to set the -qlanglvl=ansi compiler flag.  This causes the __STDC__ definition to be set at compile time.  By setting this option via the CFLAGS option in configure, the error can be eliminated.

Unfortunately, setting this flag breaks the build of libiberty in several source files by bringing up complaints about multiply defined symbols.  The problem here is that config.h defines the inline symbol, but so does ansidecl.h.  I notice ansidecl.h does a pre-emptive undef of inline.  I verified that if the order of the includes is guaranteed to be "config.h" followed by "ansidecl.h" followed by  "libiberty.h", the build of libiberty succeeds.  gcc/dependence.c later gets a similar error by virtue of the abs macro conflicting with one in stdlib.h.

Also, the build of the files in gcc/intl does not pick up the changes to CFLAGS during "make bootstrap".  It seems the gcc/Makefile is not picking up the customized CFLAGS during configure.  I suspect gcc/configure.in is the reason why this is the case, but I don't know enough about the autoconf tool to provide a fix.

If it is considered a "good idea" to use the compiler flag to set the __STDC__ definition, I am willing to do what I can to clean up the build.  An obvious alternative is to re-write the affected part of plural.c to not expose this error.  

I can also provide a patch for this if needed.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]