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

--- Comment #3 from Michael Bruck <bruck.michael at googlemail dot com> 
2011-11-28 02:44:16 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > I don't think this is a bug as in_data can be changed by a different 
> > function
> > other than bar().
> 
> Before I stripped this down to a test case in_data was actually a const coming
> from a second function (into which bar was being inlined by gcc).
> 
> Apart from that even if modified elsewhere gcc should IMO not assume that that
> modification produces an ill-formed in_data that triggers case 0x02.
> 

To illustrate a bit further why it is a problem, what I originally did was have
bar() parse in_data. But not as global constant but passed as parameter. bar()
in this case parses all sorts of different versions of in_data, some actually
containing 0x02 and a valid length.

To test this I added a second function to call bar() with a test case. That
test case does not include 0x02. This triggers the error even though it is
well-formed. I have to make the test case larger than 16+1 bytes to kill the
error. But my test case and that function are otherwise correct code.

Also curiously, if I add const before the "size_t in_length = ..." the error
goes away.

Reply via email to