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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to