public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4022] New: wchar.h is broken when gcc 4.3 is used with option --std=gnu99
@ 2007-02-10 22:08 bruno at clisp dot org
  2007-02-17  7:30 ` [Bug libc/4022] " drepper at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2007-02-10 22:08 UTC (permalink / raw)
  To: glibc-bugs

Applies to glibc-2.3.x to 2.5 (but the bugtracker does not have a combobox entry
for glibc-2.5).

The gcc 4.3 development branch apparently implements 'inline' more closely to
ISO C 99, when --std=gnu99 is used. Use of <wchar.h> in at least two compilation
units leads to link errors:

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.3-20070209/configure
--prefix=/house/bhaible2/prefix-linux-x86_64/gnu-inst-gcc/4.3-20070209
--enable-shared --enable-version-specific-runtime-libs --enable-threads=posix
--enable-__cxa_atexit
Thread model: posix
gcc version 4.3.0 20070209 (experimental)

$ cat foo1.c
#include <wchar.h>
extern int zero (void);
int main () { return zero(); }
$ cat foo2.c
#include <wchar.h>
int zero (void) { return 0; }
$ gcc -static --std=gnu99 -O2 -Wall foo1.c foo2.c 
/tmp/cc0muMOp.o: In function `wcstoul':
foo2.c:(.text+0x10): multiple definition of `wcstoul'
/tmp/ccMA19co.o:foo1.c:(.text+0x10): first defined here
/tmp/cc0muMOp.o: In function `wcstol':
foo2.c:(.text+0x20): multiple definition of `wcstol'
/tmp/ccMA19co.o:foo1.c:(.text+0x20): first defined here
/tmp/cc0muMOp.o: In function `wcstod':
foo2.c:(.text+0x30): multiple definition of `wcstod'
/tmp/ccMA19co.o:foo1.c:(.text+0x30): first defined here
/usr/lib/../lib64/libc.a(wcstol.o): In function `wcstoq':
(.text+0x10): multiple definition of `wcstol'
/tmp/ccMA19co.o:foo1.c:(.text+0x20): first defined here
/usr/bin/ld: Warning: size of symbol `wcstol' changed from 7 in /tmp/ccMA19co.o
to 18 in /usr/lib/../lib64/libc.a(wcstol.o)
/usr/lib/../lib64/libc.a(wcstoul.o): In function `wcstouq':
(.text+0x10): multiple definition of `wcstoul'
/tmp/ccMA19co.o:foo1.c:(.text+0x10): first defined here
/usr/bin/ld: Warning: size of symbol `wcstoul' changed from 7 in /tmp/ccMA19co.o
to 18 in /usr/lib/../lib64/libc.a(wcstoul.o)
collect2: ld returned 1 exit status

Look closer what's happening:

$ gcc --std=gnu99 -O2 -c foo2.c
$ nm foo2.o
                 U __wcstod_internal
                 U __wcstol_internal
                 U __wcstoul_internal
0000000000000030 T wcstod
0000000000000020 T wcstol
0000000000000010 T wcstoul
0000000000000000 T zero

The inclusion of <wchar.h> causes the compilation unit to export wcstoul etc.
(on 32-bit platforms also wcstouq etc.). The reason is that these functions
are
  - first declared as "extern",
  - then defined as "extern __inline",
This combination causes the functiona to be exported according to the rules of
ISO C 99. For more details about the semantics of "inline" and the earlier
gcc semantics, see
  http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html

-- 
           Summary: wchar.h is broken when gcc 4.3 is used with option --
                    std=gnu99
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: bruno at clisp dot org
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=4022

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/4022] wchar.h is broken when gcc 4.3 is used with option --std=gnu99
  2007-02-10 22:08 [Bug libc/4022] New: wchar.h is broken when gcc 4.3 is used with option --std=gnu99 bruno at clisp dot org
@ 2007-02-17  7:30 ` drepper at redhat dot com
  2007-03-22  8:46 ` jakub at redhat dot com
  2007-03-23  1:08 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: drepper at redhat dot com @ 2007-02-17  7:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-02-17 07:30 -------
The last word about this bogus change isn't spoken.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
             Status|NEW                         |SUSPENDED


http://sourceware.org/bugzilla/show_bug.cgi?id=4022

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/4022] wchar.h is broken when gcc 4.3 is used with option --std=gnu99
  2007-02-10 22:08 [Bug libc/4022] New: wchar.h is broken when gcc 4.3 is used with option --std=gnu99 bruno at clisp dot org
  2007-02-17  7:30 ` [Bug libc/4022] " drepper at redhat dot com
@ 2007-03-22  8:46 ` jakub at redhat dot com
  2007-03-23  1:08 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at redhat dot com @ 2007-03-22  8:46 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-03-22 08:46 -------
Should be fixed with SVN trunk gcc and CVS trunk glibc (after -fgnu89-inline
addition on the GCC side and glibc __extern_inline changes).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=4022

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/4022] wchar.h is broken when gcc 4.3 is used with option --std=gnu99
  2007-02-10 22:08 [Bug libc/4022] New: wchar.h is broken when gcc 4.3 is used with option --std=gnu99 bruno at clisp dot org
  2007-02-17  7:30 ` [Bug libc/4022] " drepper at redhat dot com
  2007-03-22  8:46 ` jakub at redhat dot com
@ 2007-03-23  1:08 ` bruno at clisp dot org
  2 siblings, 0 replies; 4+ messages in thread
From: bruno at clisp dot org @ 2007-03-23  1:08 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From bruno at clisp dot org  2007-03-23 01:08 -------
> Should be fixed with SVN trunk gcc and CVS trunk glibc

Thanks. This should solve it for the long-term future.

What about people who have a glibc 2.3.x/2.4/2.5 system and want to
install gcc-4.3? Will you distribute your glibc modifications as a patch
to be applied in /usr/include? Or will gcc's 'fixincludes' pass apply your
patch?


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4022

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2007-03-23  1:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-10 22:08 [Bug libc/4022] New: wchar.h is broken when gcc 4.3 is used with option --std=gnu99 bruno at clisp dot org
2007-02-17  7:30 ` [Bug libc/4022] " drepper at redhat dot com
2007-03-22  8:46 ` jakub at redhat dot com
2007-03-23  1:08 ` bruno at clisp dot org

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).