------- Additional Comments From alexander_herrmann at yahoo dot com dot au
2005-05-13 13:06 -------
Subject: Re: 4.0/4.1 Regression __builtin_expect
Ok, than we move it into another catagory. Compiler
crashes with segmentation fault.
After 20 years of C programing it is like felling
feeling a bug. Trying to produce a testcase with || I
seem to have triggered it. The compiler get's a
segmentation fault on this one :)
aie_sql_meta.c: In Funktion aie_sql_meta_create_index:
aie_sql_meta.c:23: interner Compiler-Fehler:
Segmentation fault
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// reduced Testcase
// compiled with
// gcc -Wall -O3 aie_sql_meta.c
// Alexander J. Herrmann 13.05.2005
[EMAIL PROTECTED]
typedef int bool;
bool aie_sql_meta_create_index(void);
void aie_sql_meta_get_index_def_from_id(int indexid,
int *tableid,
int *index_typ);
int main(void)
{
aie_sql_meta_create_index();
return(0);
}
bool aie_sql_meta_create_index(void)
{
bool rc = 1;
int tableid; // Never gets initialized
int index_typ = 1;
int indexid = 0;
aie_sql_meta_get_index_def_from_id(indexid,
&tableid, &index_typ);
if (__builtin_expect(((index_typ) || (tableid <=
0)),0))
{
// error variables not set but also not used
rc = 0;
}
else
{
// tableid was never initialized
printf("%d %d\n", tableid, index_typ);
}
return(rc);
}
void aie_sql_meta_get_index_def_from_id(int indexid,
int *tableid,
int *index_typ)
{
if (indexid == 1)
{
// the Good case
*tableid = 1;
*index_typ = 0;
}
else
{
*index_typ = 0;
}
}
____________________________________________________________
http://vendian.aiengine.org - Artificial Life for your CPU
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21531