This is the mail archive of the 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: Undefined behavior in genautomata.c?

Gabriel Dos Reis <> wrote:

>>>>>   Do you suppose the idiom is common enough that VRP could
>>>>> "arrays of size 1 at the end of a struct" ?  And still obtain the
>>>>> benefits of the optimisation in 99.99% of all
>>>>> non-variable-length-tail-array cases?
>>>> It makes sense to me. We could special case "arrays of size 1 at the
>>>> of the struct", and treat it as C99 flexible array members. Any other
>>>> case could simply be considered broken.
>>> broken with respect to what?
>> broken as in undefined behaviour?
> Could you explain in detail where you see the undefined behaviour?

Accessing the array beyond its size. From the tone of your concise answers,
I deduce that this is not undefined behaviour as per the ISO C or ISO C++
standards (otherwise it would have been clear what it is undefined
behaviour); in which case, I would appreciate if you could elaborate on when
it is invalid to access an array outside its usual range.
Giovanni Bajo

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