This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't fold away division by zero (PR middle-end/66127)
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Thu, 14 May 2015 09:42:44 -0700
- Subject: Re: [PATCH] Don't fold away division by zero (PR middle-end/66127)
- Authentication-results: sourceware.org; auth=none
- References: <20150513191803 dot GG27320 at redhat dot com>
- Reply-to: <sellcey at imgtec dot com>
Marek,
This may be unrelated to your patches for PR 66127 and 66066 but I am
having a new failure when building the latest glibc with the latest GCC.
I haven't yet tracked down exactly which patch caused the problem. Included
is a cutdown test case from libio/memstream.c in glibc that results in a
strict-aliasing error. Is this is something you already know about or have
seen?
In the mean time I will try to figure out exactly which patch caused this error
to trigger.
Steve Ellcey
sellcey@imgtec.com
typedef unsigned int size_t;
extern void *malloc (size_t __size) __attribute__ ((__nothrow__ )) __attribute__
((__malloc__)) ;
struct _IO_FILE_plus { void *vtable; };
void *_IO_mem_jumps;
struct _IO_streambuf { };
typedef struct _IO_strfile_
{
struct _IO_streambuf _sbf;
} _IO_strfile;
struct _IO_FILE_memstream
{
_IO_strfile _sf;
};
void open_memstream (int bufloc, int sizeloc)
{
struct locked_FILE
{
struct _IO_FILE_memstream fp;
} *new_f;
new_f = (struct locked_FILE *) malloc (sizeof (struct locked_FILE));
((struct _IO_FILE_plus *) &new_f->fp._sf._sbf)->vtable = &_IO_mem_jumps;
}
x.c: In function 'open_memstream':
x.c:28:12: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
((struct _IO_FILE_plus *) &new_f->fp._sf._sbf)->vtable = &_IO_mem_jumps;
^
cc1: all warnings being treated as errors