Bug 460 - __func__ semantics
__func__ semantics
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c
2.96
: P3 normal
: ---
Assigned To: Nathan Sidwell
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-10 03:56 UTC by Joseph S. Myers
Modified: 2005-01-03 16:55 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2000-08-10 03:56:01 UTC
The detailed semantics of __func__ in GCC differ from those of the C99
standard:

* __func__ is not a string literal and should not take part in string
  concatenation.

* Nor should __func__ be merged with identical string literals; it is
  a separate array object.

* __func__ is an array of const char, not of plain char.  This should
  not depend on -Wwrite-strings or -fwritable-strings.

Release:
2.96

Environment:
System: Linux decomino 2.2.16 #1 Thu Jun 8 00:26:22 UTC 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu

How-To-Repeat:
See gcc.dg/c99-func-2.c for the first point.  Another test may be
written for the other points.
Comment 1 Joseph S. Myers 2000-08-15 19:10:33 UTC
From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/460: __func__ semantics
Date: Tue, 15 Aug 2000 19:10:33 +0100 (BST)

 Tests for merging of __func__ and for its type have been added as
 c99-func-3.c and c99-func-4.c.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 
Comment 2 Neil Booth 2001-02-22 15:33:36 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
Comment 3 Neil Booth 2001-02-22 23:33:36 UTC
From: neil@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jsm28@cam.ac.uk, nobody@gcc.gnu.org
Cc:  
Subject: Re: c/460
Date: 22 Feb 2001 23:33:36 -0000

 Synopsis: __func__ semantics
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: neil
 State-Changed-When: Thu Feb 22 15:33:36 2001
 State-Changed-Why:
     Confirmed.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=460&database=gcc
Comment 4 Nathan Sidwell 2001-04-19 08:27:33 UTC
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-Why: the correct semantics will fall out of the lazy decl creation
    patch that Zack & I are working on.
Comment 5 Nathan Sidwell 2001-04-19 15:27:33 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jsm28@cam.ac.uk, nathan@gcc.gnu.org,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c/460
Date: 19 Apr 2001 15:27:33 -0000

 Synopsis: __func__ semantics
 
 Responsible-Changed-From-To: unassigned->nathan
 Responsible-Changed-By: nathan
 Responsible-Changed-When: Thu Apr 19 08:27:33 2001
 Responsible-Changed-Why:
     the correct semantics will fall out of the lazy decl creation
     patch that Zack & I are working on.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=460&database=gcc
Comment 6 Nathan Sidwell 2001-04-24 01:37:02 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed with the lazy __FUNCTION__ implementation.
Comment 7 Nathan Sidwell 2001-04-24 08:37:03 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jsm28@cam.ac.uk, nathan@gcc.gnu.org
Cc:  
Subject: Re: c/460
Date: 24 Apr 2001 08:37:03 -0000

 Synopsis: __func__ semantics
 
 State-Changed-From-To: analyzed->closed
 State-Changed-By: nathan
 State-Changed-When: Tue Apr 24 01:37:02 2001
 State-Changed-Why:
     Fixed with the lazy __FUNCTION__ implementation.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=460&database=gcc