This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/15438] New: miscompilation of simple test with __errno_location ()
- From: "belyshev at lubercy dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2004 16:26:20 -0000
- Subject: [Bug c/15438] New: miscompilation of simple test with __errno_location ()
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
cat > bug.c << EOF
typedef unsigned int size_t;
extern int *__errno_location (void) __attribute__ ((__const__));
extern int printf (__const char *__restrict __format, ...);
extern void *malloc (size_t __size) __attribute__ ((__malloc__));
extern void abort (void) __attribute__ ((__noreturn__));
#define ENOMEM 12
int
main (void)
{
void *p;
*__errno_location () = 0;
p = malloc (-1);
if (*__errno_location () != ENOMEM)
abort ();
return 0;
}
EOF
gcc bug.c -O
./a.out
Aborted
--
Summary: miscompilation of simple test with __errno_location ()
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: belyshev at lubercy dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15438