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 middle-end/31309] 6 byte assignment at end of structure reads/writes past end of structure causing SEGV when that memory is not accessable.



------- Comment #19 from ebotcazou at gcc dot gnu dot org  2008-01-09 11:02 -------
> It seems that this should work too: bitsize is 8 in this example IIRC, so
> copy_mode would be byte_mode, which is what we need here.  Additionally
> using word_mode when we can seems worthwhile too.

OK, thanks.

> I believe it's impossible that TYPE_ALIGN is neither a multiple of word_mode
> nor a number for which mode_for_size ever returns BLKmode (i.e. either it
> returns BLKmode, but then only for very large aligns, which are multiples
> of word_mode, or it will return something != BLKmode, which we then
> can use).

Yes, TYPE_ALIGN is supposed to be always a power of 2 if < BITS_PER_WORDS.

> So, with that "argumentation" I think this would work, except for my
> probably theoretical fear from comment #9, that the mode argument for
> extract_bit_field is only a suggestion.

In your patch, yes, in mine, no, that's what I call "forcing" the mode.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31309


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