[llvm-bugs] [Bug 42955] New: Miscompilation when using -g, -fmodules and non-module headers

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 10 09:08:15 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42955

            Bug ID: 42955
           Summary: Miscompilation when using -g, -fmodules and non-module
                    headers
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yshuiv7 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I have not idea what is causing this, but here is the code that triggers the
bug:

https://github.com/yshui/bugs/tree/clang-8.0.1-2019-08-19

The clang command is in test.sh.

The miscompiled function is __list_insert_between, 

    new_->prev = prev;

is somehow compiled as

    new_->next = prev;

Doing either of these fixes the problem:

* Remove -g from clang command line
* Include "list.h" directly in x.c
* Remove the "triggers_the_bug" function

Tested on 8.0.1 and 9.0.0 r366556 (or git commit
1931d3cb20a00da732c5210b123656632982fde0)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190810/5589e70d/attachment.html>


More information about the llvm-bugs mailing list