This is the mail archive of the gcc-patches@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]

Re: [PATCH/expand] PR64011 Adjust bitsize when partial overflow happen for big-endian


On 01/14/15 15:31, Jiong Wang wrote:

agree, and I think the truncation is needed otherwise there may have ICE
on some target.

and I found current gcc LOCATION info is very good !
have done an experimental hack on at "expand_assignment": 4931 where the
tree is expanded,
gcc could give quite useful & accurate warning based on tree LOCATION info.

./cc1 -O2 -mbig-endian pr48335-2.c

pr48335-2.c: In function ‘f5’:
pr48335-2.c:19:29: warning: overflow here !
    ((U *)((char *) &s.d + 1))[3] = x;
                              ^

while we need to add warning at store_bit_field_using_insv where
there is no accurate LOCATION info. but looks like it's acceptable?

pr48335-2.c:19:33: warning: overflow here !
    ((U *)((char *) &s.d + 1))[3] = x;
                                  ^
Yes, I think we're on the right track now -- warn and truncate the the insertion.

I just scanned our set of warning flags to see if this would fit nicely under any of the existing flags, and it doesn't. I guess putting it under -Wextra is probably best for now.

I think the warning text should indicate that the statement will write outside the bounds of the destination object or something along those lines.

Jeff


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