m68k/cpu32 TRAP instruction?

Jeff Law law@redhat.com
Thu Oct 4 17:52:00 GMT 2018


On 10/4/18 11:01 AM, Josef Wolf wrote:
> On Thu, Oct 04, 2018 at 06:33:57AM -0600, Jeff Law wrote:
>> On 10/4/18 6:19 AM, Josef Wolf wrote:
>>> Why does gcc use those instructions? There is nothing special in the code
>>> which is now translated into those trap instructions. I don't use floating
>>> point at all, so I don't see any reason to use those instructions (and crash
>>> on them).
>>>
>> GCC will replace a NULL pointer dereference or division by zero with a
>> trap instruction.
> 
> Is this described somewhere? I am pretty much sure that there is no NULL
> pointer dereference and no division in this code. There must be something else.
You can use -fdump-tree-all-blocks-details and look at the
isolate-erroneous-paths dump file.  Those are the cases I'm aware of
where GCC will insert traps.




> 
> In addition, the crash disappears, when I insert some no-op function call at
> the beginning of one of those functions. This causes GCC to use other
> registers for local variables.
register allocation shouldn't have anything to do with whether or not
something gets translated into a trap.

jeff



More information about the Gcc-help mailing list