This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12056] New: string literal in extern inline function not unique
- From: "jbeulich at novell dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2003 16:02:32 -0000
- Subject: [Bug c++/12056] New: string literal in extern inline function not unique
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12056
Summary: string literal in extern inline function not unique
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jbeulich at novell dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The standard says (7.1.2 § 4) "A string literal in an extern inline function is
the same object in different translation units". The compiler, not emitting a
(generated) symbol, for string literals, cannot guarantee this, resulting in
address comparisons on the address of such literals obtained through different
instances of the same function to not match.
extern inline const char*test() {
return "xyz";
}
const char*test1(int i) {
return test() + i;
}