[Bug c++/96982] New: no assembler error with -O1/O2/O3, but with -O0

tangyixuan at mail dot dlut.edu.cn gcc-bugzilla@gcc.gnu.org
Tue Sep 8 13:19:07 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96982

            Bug ID: 96982
           Summary: no assembler error with -O1/O2/O3, but with -O0
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code is compiled with optimizations (-O1/O2/O3), but is not
compiled with -O0.

$ cat s.cpp

class C1 {
        static void f1 ();
};
class C2 {
        public : static void f2 () __attribute__ (( __section__ ("")));
};
inline void C2 :: f2 (){}
void C1 :: f1 (){
        C2 :: f2 ();
}

$ g++ -c -O2 s.cpp
success.

$ g++ -c -O0 s.cpp
/tmp/ccBs5PW9.s: Assembler messages:
/tmp/ccBs5PW9.s:3: Error: missing name

$ g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-20200823/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-20200823/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-11-20200823/configure --prefix=/usr/local/gcc-20200823
--enable-checking=release --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200823 (experimental) (GCC)


More information about the Gcc-bugs mailing list