Bug 38395 - emit_library_call_value_1 calls emit_push_insn() with type=NULL_TREE
Summary: emit_library_call_value_1 calls emit_push_insn() with type=NULL_TREE
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-04 10:22 UTC by Jon Beniston
Modified: 2015-01-16 20:35 UTC (History)
2 users (show)

See Also:
Host:
Target: Targets with STRICT_ALIGNMENT true
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Beniston 2008-12-04 10:22:02 UTC
emit_library_call_value_1() in calls.c can call emit_push_insn() with type=NULL_TREE and mode != BLKMode

If STRICT_ALIGNMENT is defined for the target, then, emit_push_insn() will call assign_temp (see about 40 lines into the function), passing NULL_TREE as the first param. This results in a SEGFAULT as assign_temp calls DECL_P on NULL_TREE.
Comment 1 Andrew Pinski 2008-12-23 23:30:21 UTC
          emit_push_insn (val, mode, NULL_TREE, NULL_RTX, PARM_BOUNDARY,
                          partial, reg, 0, argblock,
                          GEN_INT (argvec[argnum].locate.offset.constant),
                          reg_parm_stack_space,
                          ARGS_SIZE_RTX (argvec[argnum].locate.alignment_pad));

This only causes an issue if:
      enum machine_mode mode = argvec[argnum].mode;

is going to be BLKmode or PARM_BOUNDARY < GET_MODE_ALIGNMENT (mode).
Comment 2 Andrew Pinski 2008-12-23 23:32:51 UTC
So the question comes what target has a mode where STRICT_ALIGNMENT is going to be true and the alignment of the stack is going to be less than the alignment of that mode?

I think this is invalid.  Now x86 has a mode who's alignment is less than PARM_BOUNDARY but that is because the ABI was set in stone before those registers was added.

Do you have a target which this effects?  Is there a reason why the stack alignment is less than the largest required alignment of the modes?
Comment 3 Jon Beniston 2008-12-24 18:21:44 UTC
This is a port to a new target I am working on, so thanks for investigating.

Are you saying that PARAM_BOUNDARY and STACK_BOUNDARY must be >= BIGGEST_ALIGNMENT? 

Looking through the other ports it appears this may not be the case for m68k (depending upon command line options) and also the score port.

However, for the port I'm currently updating, I think I can reduce the size of BIGGEST_ALIGNMENT to match STACK_BOUNDARY and PARAM_BOUNDARY. Thanks.

Comment 4 Jeffrey A. Law 2015-01-16 20:35:37 UTC
Problem with an out-of-tree port doing something that GCC doesn't support.  Good note about the m68k issue that affects the netbsd port, which is being tracked via a different BZ.