I compile the following example code from configure tests of coreutils:
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
int main ()
{
if (setlocale (LC_ALL, "fr_FR") != NULL)
{
if (btowc (EOF) != WEOF)
return 1;
}
return 0;
}
Compilation flags was -O2 -std=gnu99. Compiled program run forever on x86_64
with gcc-4.4.1 and 4.3.3. Same effect with gcc-4.4.1 on i686. If I remove flag
-std=gnu99 or -O2, compiled program run normally and return zero immediately.
If I replace -O2 on -O1, program give segmentation fault. With gcc-3.3.6
program run normally.
--
Summary: Test program hang up or segmentation fault if compiled
with -std=gnu99 -O2
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uleysky at gmail 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://gcc.gnu.org/bugzilla/show_bug.cgi?id=41265