[llvm-bugs] [Bug 49700] New: Function emitted only with -g, not emitted without

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 23 08:31:44 PDT 2021


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

            Bug ID: 49700
           Summary: Function emitted only with -g, not emitted without
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: russell_gallop at sn.scee.net
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Derived from bug 49691.

With this example b() is emitted with -g enabled and not emitted without.

$ clang++ --version
clang version 13.0.0 (75e8f225e9f2fd3758ed1c8e32bf2a70f584a8e5)
...

$ cat re.cpp
template <bool()> class a {};
static bool b() { return false;}
struct B {
  B();
  a<b> c;
};
B::B() {}

$ cat test.sh
#!/bin/bash -e
SOURCE=${1:-re.cpp}
CXX=~/git/llvm-project/stage1/bin/clang++
${CXX} -c ${SOURCE} -o dbg.o -g
objdump -t dbg.o | grep "\.text" > dbg.od
${CXX} -c ${SOURCE} -o rel.o
objdump -t rel.o | grep "\.text" > rel.od
! diff dbg.od rel.od

$ ./test.sh
2d1
< 0000000000000010 l     F .text        000000000000000d _ZL1bv

-- 
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/20210323/dbe2a9e9/attachment.html>


More information about the llvm-bugs mailing list