[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] ICE segfault in 2009q3 (G++ Lite, GNU/Linux EABI)


  • To: arm-gnu@xxxxxxxxxxxxxxxx
  • Subject: Re: [arm-gnu] ICE segfault in 2009q3 (G++ Lite, GNU/Linux EABI)
  • From: Chris Winter <elwintro@xxxxxxxxx>
  • Date: Wed, 27 Jan 2010 17:33:32 -0600

Mark,

> Other than to confirm that this is of course a bug, there is probably
> little we can offer.  To analyze it properly we would need a test case
> (which need not be small).  We do try to look at test cases posted here,
> but of course we give priority to issues reported by our customers.

I understand that customers always get priority.

I've managed to distill a test case that successfully reproduces the
problem. Also attached is a preprocessed version of the file.

Compile with the following command line:

arm-none-linux-gnueabi-gcc -march=armv7-a -mtune=cortex-a8 -mfpu=neon
-mfloat-abi=softfp -fno-omit-frame-pointer -mapcs-frame
-fno-exceptions -Wall -fno-strict-aliasing -funsigned-char -O2 -c
test.c

Which produces the error message:

test.c: In function 'test_func_4':
test.c:64: internal compiler error: Segmentation fault

Uncommenting line 75 in test.c seems to allow the compilation to succeed.

--
Chris
#include <math.h>

typedef unsigned short int boolean;
typedef unsigned short int uint16;

#define TRUE 1
#define FALSE 0
#define ERROR -1

typedef struct {
    float f1;
    float f2;
    float f3;
} type1_t;

typedef struct {
    boolean b1;
    boolean b2;
    type1_t *type1_t_array;
} type2_t;

typedef struct {
    int i1;
    uint16 ui16_1;
} type3_t;

typedef struct {
    int i1;
    int i2;
    float f1;
} type4_t;

extern type3_t ext_var_1;

enum {
    CONST1,
    CONST2,
    CONST3,
};


void test_func_1(type2_t *t2_1, type3_t *t3_1);
int test_func_2(type2_t *t2_1, type3_t *t3_1);
boolean test_func_3(boolean b1, boolean b2);
uint16 test_func_4 (void);


void test_func_1(type2_t *t2_1, type3_t *t3_1)
{
    if(t3_1->ui16_1 < 2 || !test_func_2( t2_1, t3_1 )) {
        t3_1->i1 = CONST2;
    }
}

int test_func_2( type2_t *t2_1, type3_t *t3_1)
{
return test_func_4();
}

boolean test_func_3 ( boolean b1, boolean b2)
{
    return (b1 && !b2);
}

uint16 test_func_4 (void)
{
    uint16 i;
    float f1;
    float f2;
    type4_t t4_1;
    uint16 ui16_1;
    uint16 ui16_2;

    f1 = (float) INFINITY;
//    f2 = (float) INFINITY; // Uncomment this line and gcc won't crash
    ui16_1 = ERROR;
    ui16_2 = ERROR;

    if( test_func_3( TRUE, FALSE ) ) {
        for( i = 0; i < ext_var_1.ui16_1; i++ ) {
            if( i > 0 ) {
                t4_1.f1 = (float) fabs( t4_1.f1 );
                if (t4_1.f1 < f2 && t4_1.i1 == CONST3) {
                    ui16_2 = i;
                    f2 = t4_1.f1;
                }
            }
        }

        if( ui16_2 != ERROR && f2 < f1 ) {
            ui16_1 = ui16_2;
        }
    }

    return ui16_1;
}

Attachment: test.i
Description: Binary data