This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/15438] New: miscompilation of simple test with __errno_location ()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]