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

            Bug ID: 79415
           Summary: -fcheck-pointer-bounds results in internal compiler
                    error weakref attributes
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jussi.judin at ericsson dot com
  Target Milestone: ---

GCC 7.0.1 (git hash 7458afd6b35c4851d146f058435ba3dd6215db44) results in
internal compiler error on following input with -fcheck-pointer-bounds and
-mmpx options on x86_64 architecture:

void fn1();
static __typeof fn1 fn2 __attribute__((__weakref__("")));
void fn3() { void *a = (void *)fn2; }

When I compile that code, I get following output:

$ gcc-bin/bin/g++ --std=c++11 -c -fcheck-pointer-bounds -mmpx
gcc-error-verify-cgraph-node-failed.cc
gcc-error-verify-cgraph-node-failed.cc:3:37: error: node is weakref but not an
transparent_alias
 void fn3() { void *a = (void *)fn2; }
                                     ^
_ZL3fn2v.chkp/5 (void fn2.chkp()) @0x7fb2e16b7450
  Type: function alias weakref target:
  Visibility: weak
  Address is taken.
  References: 
  Referring: _Z3fn3v.chkp/2 (addr)
  Availability: not_available
  First run: 0
  Function flags:
  Called by: 
  Calls: 
  Is instrumented version.
gcc-error-verify-cgraph-node-failed.cc:3:37: internal compiler error:
verify_cgraph_node failed
0x92460b cgraph_node::verify_node()
        ../../gcc/gcc/cgraph.c:3490
0x91937c symtab_node::verify()
        ../../gcc/gcc/symtab.c:1183
0x91944f symtab_node::verify_symtab_nodes()
        ../../gcc/gcc/symtab.c:1203
0xb626a5 symtab_node::checking_verify_symtab_nodes()
        ../../gcc/gcc/cgraph.h:616
0xb626a5 symbol_table::remove_unreachable_nodes(_IO_FILE*)
        ../../gcc/gcc/ipa.c:698
0xc53fce execute_todo
        ../../gcc/gcc/passes.c:2030
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

gcc -v returns following information on Ubuntu 14.04 based x86_64 system:

Using built-in specs.
COLLECT_GCC=/home/ejusjud/local/gcc-bin/bin/g++
COLLECT_LTO_WRAPPER=/local/ejusjud/gcc-bin/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++ --enable-libmpx
--prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure
--enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin :
(reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx
--prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure
--enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin :
(reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx
--prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure
--enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin :
(reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-libmpx
--prefix=/home/ejusjud/local/gcc-bin : (reconfigured) ../gcc/configure
--enable-languages=c,c++ --enable-libmpx --prefix=/home/ejusjud/local/gcc-bin
Thread model: posix
gcc version 7.0.1 20170207 (experimental) (GCC)

Reply via email to