This is the mail archive of the gcc-prs@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]

c/9482: math builtins are always visible


>Number:         9482
>Category:       c
>Synopsis:       math builtins are always visible
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 28 16:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.3 20030114 (prerelease)
>Organization:
SuSE Linux AG
>Environment:
System: Linux byrd 2.4.19 #1 Wed Nov 13 12:23:24 UTC 2002 x86_64 unknown
Architecture: x86_64

	
host: x86_64-unknown-linux-gnu
build: x86_64-unknown-linux-gnu
target: x86_64-unknown-linux-gnu
configured with: /cvs/gcc-3_3-branch/configure --prefix=/opt/gcc/3.3-devel --disable-nls --enable-threads=posix --enable-clocale=gnu --enable-__cxa_atexit --enable-shared --enable-languages=c,c++,f77,java,objc,ada,treelang --enable-checking=misc,tree,rtl,gc,rtlflag --with-system-zlib
>Description:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#if USE_EXTERN
extern log (char *);
#endif

int
main (void)
{
  log ("hi");

  return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

According to ISO C99, log is only a reserved identifier if <math.h> is
included.  But <math.h> is not included in the example above and
therefore compilation should succeed.  But it fails as follows:

$ /opt/gcc/3.3-devel/bin/gcc -Wall -c log-test.c -O
log-test.c: In function `main':
log-test.c:9: warning: implicit declaration of function `log'
log-test.c:9: error: incompatible type for argument 1 of `log'

Use the extern declaration makes the program compile but the warnings
are still not ok:

$ /opt/gcc/3.3-devel/bin/gcc -Wall -c log-test.c -O -DUSE_EXTERN
log-test.c:3: warning: type defaults to `int' in declaration of `log'
log-test.c:3: warning: conflicting types for built-in function `log'


>How-To-Repeat:
	Compile the test program.

>Fix:
	None known besides renaming the program.
>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]