[PATCH, PR67405, committed] Avoid NULL pointer dereference

Ilya Enkovich enkovich.gnu@gmail.com
Tue Sep 15 09:30:00 GMT 2015


2015-09-13 16:36 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
> On Mon, Sep 7, 2015 at 2:39 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> 2015-09-02 15:35 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
>>>
>>> DECL_FIELD_BIT_OFFSET should be never NULL.  Whoever created that
>>> FIELD_DECL created an invalid one.
>>>
>>> Richard.
>>>
>>
>> layout_class_type doesn't place fields with no type
>
> Err - that's because fields should also have a type.

Sure. But we are talking about a wrong code and still want to continue
compilation to some point even if some field misses a type. It means
everything possibly invoked at this stage should check type against
error_mark_node. Thus I need to handle it gracefully in
chkp_find_bound_slots I suppose.

Ilya

>
>> and thus we have
>> nothing for DECL_FIELD_BIT_OFFSET. We still continue compilation and
>> function parameters gimplification causes a call to
>> chkp_find_bound_slots_1 which tries to access. So probably I should
>> handle gracefully fields with error_mark_node as a type? Or we better
>> put something into DECL_FIELD_BIT_OFFSET (zero? error_mark_node?) for
>> such fields.
>>
>> Ilya



More information about the Gcc-patches mailing list