------- Additional Comments From alexander_herrmann at yahoo dot com dot au
2005-05-13 11:16 -------
Subject: Re: 4.0/4.1 Regression __builtin_expect
The promised Testcase. Earlier than expected :)
aie_sql_meta.c: In Funktion
ปaie_sql_meta_create_indexซ:
aie_sql_meta.c:32: Warnung: ปindex_typซ
k๖nnte in dieser Funktion uninitialisiert
verwendet werden
aie_sql_meta.c:31: Warnung: ปtableidซ
k๖nnte in dieser Funktion uninitialisiert
verwendet werden
It only seems to happen with the compilerswitches
-Wall -O3
It's kinda complete program so I guess the (very
large) precompiled isn't needed. Thanks for the fast
response and btw. GCC 4.0.0 seems to be a good work.
Finds more undefined prototypes than 3.4.3. What is
kind of missing is a error and a warning number as the
messages may be in strange languages these days which
makes it hard for english only to figure out what the
message means. Just a suggestion which came to my mind
producing the testcase. Maybe I should work on that :)
in my spare time.
#include <stdlib.h>
#include <stdio.h>
// reduced Testcase
// compiled with
// gcc -Wall -O3 aie_sql_meta.c
// Alexander J. Herrmann 13.05.2005
[EMAIL PROTECTED]
typedef int bool;
struct aie_sql_index_def
{
char *something;
};
bool aie_sql_meta_create_index(int indexid);
struct aie_sql_index_def
*aie_sql_meta_get_index_def_from_id(int indexid,
int *tableid,
int *index_typ);
int main(void)
{
aie_sql_meta_create_index(1); // the good case
aie_sql_meta_create_index(0); // the never should
happen case
return(0);
}
bool aie_sql_meta_create_index(int indexid)
{
bool rc = 1;
int tableid; // These are the two variables
complained about
int index_typ;
struct aie_sql_index_def *index_def =
aie_sql_meta_get_index_def_from_id(indexid,
&tableid, &index_typ);
if (__builtin_expect(((index_def == NULL) ||
(tableid <= 0)),0))
{
// error variables not set but also not used
rc = 0;
}
else
{
// Ok, variables set and used
printf("%d %d\n", tableid, index_typ);
}
return(rc);
}
struct aie_sql_index_def
*aie_sql_meta_get_index_def_from_id(int indexid,
int *tableid,
int *index_typ)
{
static struct aie_sql_index_def aie_index_def;
if (indexid == 1)
{
// the Good case
*tableid = 1;
*index_typ = 1;
}
else
{
// The what never should happen case
return(NULL);
}
return(&aie_index_def);
}
____________________________________________________________
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