public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/9482: math builtins are always visible
@ 2003-01-28 20:26 Andreas Jaeger
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Jaeger @ 2003-01-28 20:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: Andreas Jaeger <aj@suse.de>
To: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
Cc: Andreas Jaeger <aj@suse.de>, gcc-gnats@gcc.gnu.org
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 21:20:14 +0100

 On Tue, Jan 28, 2003 at 09:11:15PM +0100, Christian Ehrhardt wrote:
 > On Tue, Jan 28, 2003 at 05:50:20PM +0100, Andreas Jaeger wrote:
 > > "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> writes:
 > > > My version of the standard says in 7.1.3:
 > > >    All identifiers with external linkage in any of the following subclauses
 > > >    (including the future library directions) are always reserved for use as
 > > >    identifiers with external linkage.
 > > > This doesn't mention the header file. Note that macros are a different
 > > > story. These are indeed only reserved if the appropriate header in included.
 > > > If you agree on this I'll close the report.
 > > 
 > > I do not (yet;-) agree.
 > > 
 > > Footnote 154 mentions: "The list of reserved identifiers with external
 > > linkage includes errno, setjmp, and va_end.".
 > 
 > This list exactly those reserved identifiers that may either be a macro
 > or an identifier with external linkage. log is definitely declared with
 > external linkage in math.h.
 > 
 > > I do not think that "log" is meant here but rather meant in the item a
 > > bit further, where 7.1.3 says:
 > > "Each identifier with file scope listed in any of the
 > >  following subclauses (including the future library directions) is
 > >  reserved for use as a macro name and as an identifier with file scope
 > >  in the same name space if any of its associated headers is included."
 > > 
 > > So, the question boils down IMO to whether "log" has "file scope" or
 > > "external linkage".
 > 
 > Most definitely external linkage. File scope would be
 > static double log (double). 
 > But then I'm not a language lawyer.
 > 
 >    regards  Christian
 > 
 > -- 
 > THAT'S ALL FOLKS!
 
 Ok, I'm convinced now.  Thanks for helping to understand the standard.
 
 I'll close the PR now myself,
 Andreas
 -- 
  Andreas Jaeger
   SuSE Labs aj@suse.de
    private aj@arthur.inka.de
     http://www.suse.de/~aj


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 20:21 aj
  0 siblings, 0 replies; 8+ messages in thread
From: aj @ 2003-01-28 20:21 UTC (permalink / raw)
  To: aj, gcc-bugs, gcc-prs, nobody

Synopsis: math builtins are always visible

State-Changed-From-To: open->closed
State-Changed-By: aj
State-Changed-When: Tue Jan 28 20:21:27 2003
State-Changed-Why:
    
    I'm convinced now that the program is not legal C, GCC is handling this correctly.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9482


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 20:16 Christian Ehrhardt
  0 siblings, 0 replies; 8+ messages in thread
From: Christian Ehrhardt @ 2003-01-28 20:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: Andreas Jaeger <aj@suse.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 21:11:15 +0100

 On Tue, Jan 28, 2003 at 05:50:20PM +0100, Andreas Jaeger wrote:
 > "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> writes:
 > > My version of the standard says in 7.1.3:
 > >    All identifiers with external linkage in any of the following subclauses
 > >    (including the future library directions) are always reserved for use as
 > >    identifiers with external linkage.
 > > This doesn't mention the header file. Note that macros are a different
 > > story. These are indeed only reserved if the appropriate header in included.
 > > If you agree on this I'll close the report.
 > 
 > I do not (yet;-) agree.
 > 
 > Footnote 154 mentions: "The list of reserved identifiers with external
 > linkage includes errno, setjmp, and va_end.".
 
 This list exactly those reserved identifiers that may either be a macro
 or an identifier with external linkage. log is definitely declared with
 external linkage in math.h.
 
 > I do not think that "log" is meant here but rather meant in the item a
 > bit further, where 7.1.3 says:
 > "Each identifier with file scope listed in any of the
 >  following subclauses (including the future library directions) is
 >  reserved for use as a macro name and as an identifier with file scope
 >  in the same name space if any of its associated headers is included."
 > 
 > So, the question boils down IMO to whether "log" has "file scope" or
 > "external linkage".
 
 Most definitely external linkage. File scope would be
 static double log (double). 
 But then I'm not a language lawyer.
 
    regards  Christian
 
 -- 
 THAT'S ALL FOLKS!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 18:06 Joseph S. Myers
  0 siblings, 0 replies; 8+ messages in thread
From: Joseph S. Myers @ 2003-01-28 18:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: Andreas Jaeger <aj@suse.de>
Cc: <gcc-gnats@gcc.gnu.org>
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 18:00:17 +0000 (GMT)

 On 28 Jan 2003, Andreas Jaeger wrote:
 
 >  So, the question boils down IMO to whether "log" has "file scope" or
 >  "external linkage".
 
 It has both.  Identifiers have both scope and linkage, as explained early
 in the standard.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 17:56 Joseph S. Myers
  0 siblings, 0 replies; 8+ messages in thread
From: Joseph S. Myers @ 2003-01-28 17:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <aj@suse.de>
Cc: <gcc-gnats@gcc.gnu.org>,  <gcc-bugs@gcc.gnu.org>
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 17:49:42 +0000 (GMT)

 On Tue, 28 Jan 2003 aj@suse.de wrote:
 
 > 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:
 
 7.1.3p1 says library identifiers are always reserved for use as
 identifiers with external linkage.  Only C94 has different rules (for some
 of the functions it added, and those special cases were removed in C99).
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 16:56 Andreas Jaeger
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Jaeger @ 2003-01-28 16:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: Andreas Jaeger <aj@suse.de>
To: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 17:50:20 +0100

 "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> writes:
 
 > On Tue, Jan 28, 2003 at 05:03:15PM +0100, aj@suse.de wrote:
 >> 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:
 >
 > My version of the standard says in 7.1.3:
 >    All identifiers with external linkage in any of the following subclauses
 >    (including the future library directions) are always reserved for use as
 >    identifiers with external linkage.
 > This doesn't mention the header file. Note that macros are a different
 > story. These are indeed only reserved if the appropriate header in included.
 > If you agree on this I'll close the report.
 
 I do not (yet;-) agree.
 
 Footnote 154 mentions: "The list of reserved identifiers with external
 linkage includes errno, setjmp, and va_end.".
 
 I do not think that "log" is meant here but rather meant in the item a
 bit further, where 7.1.3 says:
 "Each identifier with file scope listed in any of the
  following subclauses (including the future library directions) is
  reserved for use as a macro name and as an identifier with file scope
  in the same name space if any of its associated headers is included."
 
 So, the question boils down IMO to whether "log" has "file scope" or
 "external linkage".
 
 Andreas
 -- 
  Andreas Jaeger
   SuSE Labs aj@suse.de
    private aj@arthur.inka.de
     http://www.suse.de/~aj


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: c/9482: math builtins are always visible
@ 2003-01-28 16:36 Christian Ehrhardt
  0 siblings, 0 replies; 8+ messages in thread
From: Christian Ehrhardt @ 2003-01-28 16:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9482; it has been noted by GNATS.

From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: aj@suse.de
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/9482: math builtins are always visible
Date: Tue, 28 Jan 2003 17:34:58 +0100

 On Tue, Jan 28, 2003 at 05:03:15PM +0100, aj@suse.de wrote:
 > 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:
 
 My version of the standard says in 7.1.3:
    All identifiers with external linkage in any of the following subclauses
    (including the future library directions) are always reserved for use as
    identifiers with external linkage.
 This doesn't mention the header file. Note that macros are a different
 story. These are indeed only reserved if the appropriate header in included.
 If you agree on this I'll close the report.
 
    regards  Christian
 
 -- 
 THAT'S ALL FOLKS!


^ permalink raw reply	[flat|nested] 8+ messages in thread

* c/9482: math builtins are always visible
@ 2003-01-28 16:06 aj
  0 siblings, 0 replies; 8+ messages in thread
From: aj @ 2003-01-28 16:06 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-01-28 20:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-28 20:26 c/9482: math builtins are always visible Andreas Jaeger
  -- strict thread matches above, loose matches on Subject: below --
2003-01-28 20:21 aj
2003-01-28 20:16 Christian Ehrhardt
2003-01-28 18:06 Joseph S. Myers
2003-01-28 17:56 Joseph S. Myers
2003-01-28 16:56 Andreas Jaeger
2003-01-28 16:36 Christian Ehrhardt
2003-01-28 16:06 aj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).