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

            Bug ID: 85022
           Summary: internal compiler error: in write_dependence_p, at
                    alias.c:3003
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at oracle dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

class b extern c;
void a() {
  asm("" : "+m"(c));
}

Output:

$ cc1plus -O1
 void a()
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <build_ssa_passes> <opt_local_passes>
<targetclone> <free-fnsummary> <whole-program> <profile_estimate> <fnsummary>
<inline> <pure-const> <free-fnsummary> <static-var> <single-use>
<comdats>Assembling functions:
 <materialize-all-clones> <simdclone> void a()during RTL pass: cse1

<stdin>: In function 'void a()':
<stdin>:4:1: internal compiler error: in write_dependence_p, at alias.c:3003
0x16a44f3 write_dependence_p
        /home/vegard/git/gcc/gcc/alias.c:3001
0x16a5867 canon_anti_dependence(rtx_def const*, bool, rtx_def const*,
machine_mode, rtx_def*)
        /home/vegard/git/gcc/gcc/alias.c:3092
0x5153789 check_dependence
        /home/vegard/git/gcc/gcc/cse.c:1816
0x5153789 invalidate
        /home/vegard/git/gcc/gcc/cse.c:1946
0x518e226 cse_insn
        /home/vegard/git/gcc/gcc/cse.c:5832
0x519b4b7 cse_extended_basic_block
        /home/vegard/git/gcc/gcc/cse.c:6610
0x519b4b7 cse_main
        /home/vegard/git/gcc/gcc/cse.c:6789
0x51a15bf rest_of_handle_cse
        /home/vegard/git/gcc/gcc/cse.c:7619
0x51a15bf execute
        /home/vegard/git/gcc/gcc/cse.c:7662
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Version:

GNU C++14 (GCC) version 8.0.1 20180306 (experimental) (x86_64-pc-linux-gnu)

7.3.0 compiles it to just a "ret" and clang fails with:

<source>:3:17: error: dereference of pointer to incomplete type 'class b'
  asm("" : "+m"(c));
                ^
<source>:1:7: note: forward declaration of 'b'
class b extern c;
      ^
1 error generated.
Compiler returned: 1

Reply via email to