https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83166
Bug ID: 83166
Summary: [8 regression] error: type mismatch in pointer diff
expression internal compiler error: verify_gimple
failed
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: skpgkp1 at gmail dot com
Target Milestone: ---
This issue appear in dmtcp build with GCC 8.0. GCC 7.2.1 works fine.
$ cat mtcp_restart.i.c
char a;
b() { long c = (char *)b - &a; }
### Fail with GCC 8.0
$gcc --version
gcc (GCC) 8.0.0 20171124 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$gcc -g -O2 -c -o mtcp_restart.i.c.o -fPIC -fno-stack-protector -g -O0
mtcp_restart.i.c
mtcp_restart.i.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
b() { long c = (char *)b - &a; }
^
mtcp_restart.i.c: In function ‘b’:
mtcp_restart.i.c:2:1: error: type mismatch in pointer diff expression
long int
int (*<T2f9>) ()
char *
c = b - &a;
mtcp_restart.i.c:2:1: internal compiler error: verify_gimple failed
0xd4a52d verify_gimple_in_seq(gimple*)
../../gcc-main.3O1G/gcc/tree-cfg.c:5094
0xb00bdd gimplify_body(tree_node*, bool)
../../gcc-main.3O1G/gcc/gimplify.c:12606
0xb00dc4 gimplify_function_tree(tree_node*)
../../gcc-main.3O1G/gcc/gimplify.c:12696
0x998d47 cgraph_node::analyze()
../../gcc-main.3O1G/gcc/cgraphunit.c:670
0x99b835 analyze_functions
../../gcc-main.3O1G/gcc/cgraphunit.c:1131
0x99c412 symbol_table::finalize_compilation_unit()
../../gcc-main.3O1G/gcc/cgraphunit.c:2690
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.
### Pass with GCC 7.2.1
$gcc --version
gcc (GCC) 7.2.1 20171124
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$gcc -g -O2 -c -o mtcp_restart.i.c.o -fPIC -fno-stack-protector -g -O0
mtcp_restart.i.c
mtcp_restart.i.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
b() { long c = (char *)b - &a; }
^
$ echo $?
0