Bug #11510 Internal compiler error in innobase/btr/btr0cur.c
Submitted: 22 Jun 2005 15:56 Modified: 17 Aug 2005 17:12
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.0.8-pre OS:Linux (Linux/IA64, Linux/EM64T)
Assigned to: Marko Mäkelä CPU Architecture:Any

[22 Jun 2005 15:56] Lenz Grimmer
The compilation of InnoDB fails with an internal compiler error, when compiling with Intel icc 8.1 on Linux/IA64 and Linux/EM64T:

if icc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I./../../include -I../../include    -DDBUG_OFF -O3 -DDBUG_OFF -O1 -ip   -DDEBUG_OFF -DUNIV_LINUX -MT btr0cur.o -MD -MP -MF ".deps/btr0cur.Tpo" -c -o btr0cur.o btr0cur.c; \
then mv -f ".deps/btr0cur.Tpo" ".deps/btr0cur.Po"; else rm -f ".deps/btr0cur.Tpo"; exit 1; fi
icc: Command line warning: overriding '-O3' with '-O1'
(0): internal error: 101004_19

compilation aborted for btr0cur.c (code 4)
make: *** [btr0cur.o] Error 1

This happens with Intel icc 8.1 (l_cce_pc_8.1.028) on Red Hat Linux AS3 / EM64T as well as with icc 8.1 (l_cc_pc_8.1.032) on Red Hat Linux AS3 / IA64

How to repeat:
Compile the attached file with an Intel compiler with the version number stated above by using the following command:

$  icc -o btr0cur.o btr0cur.E.c
(0): internal error: 101004_19

compilation aborted for btr0cur.E.c (code 4)
[22 Jun 2005 15:57] Lenz Grimmer
btr0cur.E.c.gz, created using the "-E" compile option

Attachment: btr0cur.E.c.gz (application/x-gzip, text), 87.93 KiB.

[23 Jun 2005 3:58] Heikki Tuuri

has the compilation succeeded at some time in the past?

Marko has apparently made only trivial changes to btr0cur.c lately. There are also changes in the inline code (.ic files included in .h files) that is included into btr0cur.c. Since the compiler does not tell us where it crashes, it is hard to say how we could work around the compiler bug.



heikki@hundin:~/mysql-5.0/innobase/btr> bk prs btr0cur.c | more
======== btr0cur.c 1.1..1.51 ========
D 1.51 05/06/22 12:21:08+03:00 marko@hundin.mysql.fi 85 84 1/3/3813
P innobase/btr/btr0cur.c
C Replace for loop with memset()
D 1.50 05/06/14 12:21:31+03:00 marko@hundin.mysql.fi 84 83 1/0/3815
P innobase/btr/btr0cur.c
C Code formatting: add blank line before "goto"
D 1.49 05/06/10 11:32:30+03:00 marko@hundin.mysql.fi 83 82 15/5/3800
P innobase/btr/btr0cur.c
C Move the flag btr_cur_print_record_ops behind #ifdef UNIV_DEBUG.
C Remove unused variable btr_cur_rnd.
D 1.48 05/04/27 12:28:34+03:00 marko@hundin.mysql.fi 82 81 13/9/3792
P innobase/btr/btr0cur.c
C Add debug assertions about page_rec_is_comp().
C Note that rec_get_deleted_flag() returns zero/nonzero ulint
C instead of FALSE/TRUE ibool.
[7 Jul 2005 6:15] Lenz Grimmer
Update: Intel was able to reproduce it, they are working on a fix. They reduced it to the test case listed below. They assume 'builtin_expect' is the main cause but modifying the test case below in any way causes the file to be compiled fine.

static inline int rrr( char* rec, int comp)
if (__builtin_expect(comp, ((unsigned long int) 1 << 31))) {
return(__builtin_expect(rec_get_bit_field_1(rec, 5, 0x20UL, 0), (0)));
} else {
return(__builtin_expect(rec_get_bit_field_1(rec, 6, 0x20UL, 0), (0)));


char* block, rec;
if ( !rrr(rec, p(bb(block)))) b(rec);
[23 Jul 2005 0:25] Heikki Tuuri

Ok, I was afraid that builtin_expect etc. might cause some trouble with some compilers.


[25 Jul 2005 6:12] Marko Mäkelä
I was a little surprised that icc apparently defines __GNUC__ and defines __builtin_expect(). Is there some preprocessor symbol that could be used for detecting icc and disabling __builtin_expect() on buggy icc versions?
[27 Jul 2005 8:46] Axel Schwenke
I could reproduce this with icc-9.023. Intel promises a patch in 2-3 weeks. One possible workaround is, to specify the -no-gcc option to icc.
[27 Jul 2005 9:11] Axel Schwenke

ICC defines several unique macros, i.e. __ICC or __INTEL_COMPILER. I managed to compile MySQL with ICC/9 with the following modification in univ.i:

--- innobase/include/univ.i.orig        2005-07-27 11:05:57.144585057 +0200
+++ innobase/include/univ.i     2005-07-27 10:52:45.488195613 +0200
@@ -244,7 +244,7 @@
 /* Some macros to improve branch prediction and reduce cache misses */
-#if defined(__GNUC__) && (__GNUC__ > 2)
+#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
 /* Tell the compiler that 'expr' probably evaluates to 'constant'. */
 # define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
 /* Tell the compiler that a pointer is likely to be NULL */
[17 Aug 2005 14:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[17 Aug 2005 15:08] Heikki Tuuri

To work around the Intel compiler bug, I have now pushed Axel's patch to 5.0.12. When the Intel compiler bug is fixed in the future, we can remove the patch again.

Thank you,

[17 Aug 2005 17:12] Paul Dubois
Noted in 5.0.12 changelog.