Bug 14505 - __builtin_constant_p(__func__) is not true
Summary: __builtin_constant_p(__func__) is not true
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.3
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2004-03-09 18:21 UTC by Alex Rosenberg
Modified: 2006-02-18 18:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-18 18:12:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Rosenberg 2004-03-09 18:21:34 UTC
The following code emits "non constant" but conceptually should emit "constant". The type of __func__ 
is "static const char *" so either fold_builtin_constant_p needs to be relaxed a bit or fname_decl should 
be building STRING_CST.

int main(int argc, char **argv)
{ 
  puts (__builtin_constant_p(__func__) ? "constant" : "non constant");
}
Comment 1 Andrew Pinski 2004-03-09 19:49:02 UTC
Confirmed on the mainline and on the tree-ssa.
Comment 2 Andrew Pinski 2004-06-08 03:31:36 UTC
Well note that it cannot be a STRING_CST as the C99 standard defines __func__ as a variable.