[LLVMbugs] [Bug 9892] New: clang can miscompile GNU gettext's xgettext.c

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 10 13:14:21 PDT 2011


           Summary: clang can miscompile GNU gettext's xgettext.c
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=6574)
 --> (http://llvm.org/bugs/attachment.cgi?id=6574)
Excerpt from xgettext.c, demonstrating miscompilation

After building GNU gettext on FreeBSD, using clang r131133, I
noted that any invocation of the 'xgettext' tool, whether with or
without arguments, resulted in an error:

xgettext: A --flag argument doesn't have the <keyword>:<argnum>:[pass-]<flag>
syntax: gettext:1:pass-c-format

Compiling the same program without optimization, or using gcc, gives the
expected behaviour.

I reduced the code that is miscompiled to the attached sample.  If you
compile this using clang -O0, and run it, it prints "good", followed by
the two pointer values that have just been checked for equality.

If you compile it using clang -O1, or clang -O2, it prints "bad",
followed by the two pointer values again.

Strangely, at -O3, the failure goes away...

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list