Bug 56417 - internal compiler error: verify_gimple failed
Summary: internal compiler error: verify_gimple failed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-21 10:01 UTC by Roel Van de Paar
Modified: 2013-08-13 19:57 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.8.1, 4.9.0
Last reconfirmed: 2013-02-21 00:00:00


Attachments
gcc49-pr56417.patch (914 bytes, patch)
2013-07-22 20:45 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roel Van de Paar 2013-02-21 10:01:37 UTC
I was trying to compile Percona Server with gcc 4.8 with ASan (trunk build) and ran into this during the build-binary.sh script supplied with Percona Server:

===========
[  7%] Building C object cmd-line-utils/readline/CMakeFiles/readline.dir/readline.c.o
cd /percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils/readline && /usr/local/bin/gcc  -DHAVE_RESPONSE_TIME_DISTRIBUTION -DHAVE_CONFIG_H -DHAVE_CONFIG_H -DNO_KILL_INTR -fsanitize=address -fno-omit-frame-pointer -fPIC -Wall -O3 -g -static-libgcc -fno-omit-frame-pointer -DPERCONA_INNODB_VERSION=rel29.3    -fPIC -Wall -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DENABLED_DEBUG_SYNC -I/percona-server/5.5/Percona-Server-5.5.28-rel29.3/include -I/percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils    -o CMakeFiles/readline.dir/readline.c.o   -c /percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils/readline/readline.c/percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils/readline/readline.c: In function '_rl_dispatch_subseq':
/percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils/readline/readline.c:690:1: error: type mismatch in pointer plus expression
 _rl_dispatch_subseq (key, map, got_subseq)
 ^
int (*<Tcf4>) (int, int)

char *

long unsigned int

_309 = _298 + _120;

/percona-server/5.5/Percona-Server-5.5.28-rel29.3/cmd-line-utils/readline/readline.c:690:1: internal compiler error: verify_gimple failed
0x903f9c verify_gimple_in_cfg(function*)
        ../.././gcc/tree-cfg.c:4727
0x83e7b7 execute_function_todo
        ../.././gcc/passes.c:1970
0x83f0d7 execute_todo
        ../.././gcc/passes.c:1999
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.
make[2]: *** [cmd-line-utils/readline/CMakeFiles/readline.dir/readline.c.o] Error 1
make[2]: Leaving directory `/percona-server/5.5/Percona-Server'
make[1]: *** [cmd-line-utils/readline/CMakeFiles/readline.dir/all] Error 2
make[1]: Leaving directory `/percona-server/5.5/Percona-Server'
make: *** [all] Error 2
===========

I realize there is seemingly an issue in the code, but it is interesting to see the "internal compiler error: verify_gimple failed".

I tried making a reduced testcase, but ran into issues there so decided to just log this bug as-is as a FYI.

Note that Percona Server compiles with gcc 4.7.2

To repeat, you may be able to do something like this:

$ bzr branch -rjenkins@jenkins.percona.com-20130220064132-vewblweu0emq39np lp:percona-server/5.5
$ cd 5.5
$ gcc --version | grep GCC ; /usr/local/bin/gcc --version
gcc (GCC) 4.8.0 20130218 (experimental)
gcc (GCC) 4.8.0 20130218 (experimental)
$ export LD_LIBRARY_PATH=/usr/local/lib  # messy libraries
$ chmod +x ./build/build-binary.sh
$ ./build/build-binary.sh [--debug] .    # try with/without --debug

other version info: gmp: 5.1.1, mpfr: 3.1.1, mpc: 1.0, flex: 2.5.37

$ uname -a   # Fedora Core x64
Linux <dns_name> 3.6.10-2.fc17.x86_64 #1 SMP Tue Dec 11 18:07:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

See bug 49731 and bug 50363 for more "internal compiler error: verify_gimple failed"
Comment 1 Jakub Jelinek 2013-02-21 10:06:59 UTC
Without the preprocessed source this bugreport is useless, please see http://gcc.gnu.org/bugs.html for instructions.
Comment 2 Antoine Balestrat 2013-03-17 10:18:59 UTC
Here is a testcase reduced from Percona's readline.c which makes GCC 4.9.0 as of 20130316 crash :

$ cat f.c
typedef type();
int a;
type k;

f()
{
    a = strlen(&k);
}

$ xgcc -w -fsanitize=address f.c
f.c: In function ‘f’:
f.c:5:1: error: type mismatch in pointer plus expression
 f()
 ^
int (*<T39a>) ()

char *

long unsigned int

_14 = _3 + _1;

f.c:5:1: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 3 David Binderman 2013-07-12 10:36:53 UTC
Still seems to be broken with 20130710.

An additional test case is available on request.
Comment 4 Marek Polacek 2013-07-12 18:30:05 UTC
Yeah, confirmed.
Comment 5 Marek Polacek 2013-07-20 12:17:53 UTC
Cleaned-up & reduced testcase:

/* PR sanitizer/56417 */
/* { dg-do compile } */
/* { dg-options "-w" } */

int
foo (void)
{
  return __builtin_strlen (&foo);
}
Comment 6 Jakub Jelinek 2013-07-22 20:45:36 UTC
Created attachment 30536 [details]
gcc49-pr56417.patch

Untested fix.  Though, strlen on function address?  Ugh.
Comment 7 Jakub Jelinek 2013-08-13 19:57:47 UTC
Author: jakub
Date: Tue Aug 13 16:58:46 2013
New Revision: 201696

URL: http://gcc.gnu.org/viewcvs?rev=201696&root=gcc&view=rev
Log:
	PR sanitizer/56417
	* asan.c (instrument_strlen_call): Fix typo in comment.
	Use char * type even for the lhs of POINTER_PLUS_EXPR.

	* gcc.dg/asan/pr56417.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/asan/pr56417.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/asan.c
    trunk/gcc/testsuite/ChangeLog

Author: jakub
Date: Tue Aug 13 17:02:13 2013
New Revision: 201697

URL: http://gcc.gnu.org/viewcvs?rev=201697&root=gcc&view=rev
Log:
	PR sanitizer/56417
	* asan.c (instrument_strlen_call): Fix typo in comment.
	Use char * type even for the lhs of POINTER_PLUS_EXPR.

	* gcc.dg/asan/pr56417.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/asan/pr56417.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/asan.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog