ppelissi at caramail dot com
2005-07-26 13:00:43 UTC
The follwing program:
#include <stdio.h>
#define LOG
FILE *log_file;
int f2 (int x)
{
#ifdef LOG
static long toto = 0;
static const char *fname = __func__;
static void __attribute__ ((destructor)) f (void) {
fprintf (log_file, "%s: toto=%ld\n", fname, toto);
}
toto += x;
#endif
return 42;
}
int main ()
{
log_file = fopen ("toto.log", "w");
f2 (3);
return 0;
}
failed to compile with GCC 4.0.0 and GCC 4.0.1:
morpork tmp 69 % /localdisk/gcc-4.0.1/bin/gcc tgcc.c
tgcc.c: In function 'f2':
tgcc.c:12: error: invalid storage class for function 'f'
morpork tmp 68 % /localdisk/gcc-4.0.1/bin/gcc --version
gcc (GCC) 4.0.1
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
whereas it works perfectly with GCC 3.2.x, 3.3.x and GCC 3.4.x.
--
Summary: GNU C extension / attribute destructor + static :
invalid storage class for function
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ppelissi at caramail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23076
#include <stdio.h>
#define LOG
FILE *log_file;
int f2 (int x)
{
#ifdef LOG
static long toto = 0;
static const char *fname = __func__;
static void __attribute__ ((destructor)) f (void) {
fprintf (log_file, "%s: toto=%ld\n", fname, toto);
}
toto += x;
#endif
return 42;
}
int main ()
{
log_file = fopen ("toto.log", "w");
f2 (3);
return 0;
}
failed to compile with GCC 4.0.0 and GCC 4.0.1:
morpork tmp 69 % /localdisk/gcc-4.0.1/bin/gcc tgcc.c
tgcc.c: In function 'f2':
tgcc.c:12: error: invalid storage class for function 'f'
morpork tmp 68 % /localdisk/gcc-4.0.1/bin/gcc --version
gcc (GCC) 4.0.1
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
whereas it works perfectly with GCC 3.2.x, 3.3.x and GCC 3.4.x.
--
Summary: GNU C extension / attribute destructor + static :
invalid storage class for function
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ppelissi at caramail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23076