Bug 14715 - [3.4 only] Altivec stack layout may overlap gpr save with stack temps
Summary: [3.4 only] Altivec stack layout may overlap gpr save with stack temps
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.3.3
: P2 normal
Target Milestone: 3.4.1
Assignee: Alan Modra
Keywords: ice-on-valid-code, patch
: 14953 (view as bug list)
Depends on:
Reported: 2004-03-24 12:12 UTC by David Eger
Modified: 2005-07-23 22:49 UTC (History)
3 users (show)

See Also:
Host: ppc-linux-gnu
Target: ppc-linux-gnu
Build: ppc-linux-gnu
Known to work: 4.0.0
Known to fail:
Last reconfirmed:

preprocessed source (46.57 KB, application/octet-stream)
2004-03-24 12:14 UTC, David Eger

Note You need to log in before you can comment on or make changes to this bug.
Description David Eger 2004-03-24 12:12:28 UTC
When trying to build mozilla-1.6-r1 (on gentoo) the build dies with the
following error message:

gcc -o jsobj.o -c -DOSTYPE=\"Linux2.4\" -DOSARCH=\"Linux\" -DEXPORT_JS_API 
-DJS_USE_SAFE_ARENA   -I../../dist/include/js -I../../dist/include
-I/var/tmp/portage/mozilla-1.6-r1/work/mozilla/dist/include/nspr     -I.
-I/usr/X11R6/include   -fPIC -I/usr/X11R6/include -Wall -W -Wno-unused
-Wpointer-arith -Wcast-align -Wno-long-long -O2 -pipe -mcpu=7450 -s -fforce-addr
-fno-strict-aliasing -pthread -pipe  -DNDEBUG -DTRIMMED -ffunction-sections -O2
 -I/usr/X11R6/include -include ../../mozilla-config.h -DMOZILLA_CLIENT
-Wp,-MD,.deps/jsobj.pp jsobj.c
jsobj.c: In function `js_DefineNativeProperty':
jsobj.c:2315: error: Attempt to delete prologue/epilogue insn:
(insn/f 692 691 693 0 (nil) (set (mem:SI (plus:SI (reg/f:SI 1 r1)
                (const_int 32 [0x20])) [0 S4 A8])
        (reg:SI 20 r20)) -1 (nil)
    (expr_list:REG_FRAME_RELATED_EXPR (set (mem:SI (plus:SI (reg/f:SI 1 r1)
                    (const_int 32 [0x20])) [0 S4 A8])
            (reg:SI 20 r20))
jsobj.c:2315: internal compiler error: in propagate_one_insn, at flow.c:1741

make[3]: *** [jsobj.o] Error 1
make[3]: Leaving directory `/var/tmp/portage/mozilla-1.6-r1/work/mozilla/js/src'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/var/tmp/portage/mozilla-1.6-r1/work/mozilla/js'
make[1]: *** [tier_2] Error 2
make[1]: Leaving directory `/var/tmp/portage/mozilla-1.6-r1/work/mozilla'
make: *** [default] Error 2
Comment 1 David Eger 2004-03-24 12:14:45 UTC
Created attachment 5988 [details]
preprocessed source
Comment 2 lu_zero 2004-04-07 12:20:46 UTC
the same issue reported on the latest snapshot from the 20040407.
strangely enough seems that building with the -O2 avoid the issue, but produces
wrong code.
Comment 3 lu_zero 2004-04-07 12:26:27 UTC
just to make life easyer: the gcc-3.3.3_pre${date} is the snapshot from the
hammer-3_3-branch from the same date.

the problem is present on every mozilla and alwasy on the same file, I couldn't
reduce it to a proper testcase yet

the bug seems to be trigger by the absence of -fstrict-aliasing (that's why -O2
doesn't show the problem but -O1 does)
Comment 4 Andrew Pinski 2004-04-07 13:34:22 UTC
I cannot reproduce this on either the mainline or the 3.3 branch so it must only effect the hammer 
Comment 5 Alan Modra 2004-04-15 07:01:51 UTC
*** Bug 14953 has been marked as a duplicate of this bug. ***
Comment 6 Alan Modra 2004-04-15 07:52:40 UTC
From my preliminary analysis, I would guess that this bug affects 3.4 and 3.5
too, and it's just a matter of finding the right testcase.

With hammer branch, the underlying problem is that a stack temp is allocated to
the same location as a gpr save slot.  Flow analysis notices that the gpr save
is overwritten, so decides that the gpr save is dead and should be deleted. 
This leads to the ICE.

Stack vars and temps are allocated at STARTING_FRAME_OFFSET, which rs6000.h
defines as:
  (RS6000_ALIGN (current_function_outgoing_args_size,			\
		 TARGET_ALTIVEC ? 16 : 8)				\
   + RS6000_VARARGS_AREA						\
   + RS6000_SAVE_AREA)

The first term of this expression accounts for parameter save area, but
rs6000.c:rs6000_stack_info uses
  info_ptr->parm_size    = RS6000_ALIGN (current_function_outgoing_args_size,

It is the difference in alignment that results in stack layout errors.  Note
that this error may be masked by alignment of other elements of the stack.
Comment 7 Alan Modra 2004-04-15 08:12:10 UTC
Patch at http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00879.html
Comment 8 Giovanni Bajo 2004-04-15 09:41:49 UTC
Alan, if you're positive that the patch is needed for 3.3 (non hammer), 3.4 and 
mainline as well, would you please update the bug summary to reflect that this 
is a indeed a regression?
Comment 9 GCC Commits 2004-04-17 12:40:10 UTC
Subject: Bug 14715

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amodra@gcc.gnu.org	2004-04-17 12:40:07

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c 

Log message:
	PR target/14715
	* config/rs6000/rs6000.c (rs6000_stack_info): Make parm_size agree


Comment 10 GCC Commits 2004-04-17 12:44:43 UTC
Subject: Bug 14715

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	hammer-3_3-branch
Changes by:	amodra@gcc.gnu.org	2004-04-17 12:44:40

Modified files:
	gcc            : ChangeLog.hammer 
	gcc/config/rs6000: rs6000.c 

Log message:
	PR target/14715
	* config/rs6000/rs6000.c (rs6000_stack_info): Make parm_size agree


Comment 11 GCC Commits 2004-04-30 16:43:54 UTC
Subject: Bug 14715

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	dje@gcc.gnu.org	2004-04-30 16:43:50

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : install.texi invoke.texi 
	gcc/config/rs6000: rs6000.c rs6000.h rs6000.md 
Added files:
	gcc/config/rs6000: power5.md 

Log message:
	2004-04-19  David Edelsohn  <edelsohn@gnu.org>
	* doc/install.texi (*-ibm-aix*): Add AIX 5.1 assembler and archiver
	fix information.
	2004-04-17  Alan Modra  <amodra@bigpond.net.au>
	PR target/14715
	* config/rs6000/rs6000.c (rs6000_stack_info): Make parm_size agree
	2004-04-07  David Edelsohn  <edelsohn@gnu.org>
	* config/rs6000/rs6000.c (processor_target_table): Add MASK_MFCRF
	to power4 and power5 entries.
	2004-04-05  David Edelsohn
	* config/rs6000/rs6000.c (VTABLE_NAME_P): Add _ZTI to special
	symbol handling.
	2004-03-30  Hartmut Penner  <hpenner@de.ibm.com>
	PR 11591
	* config/rs6000/rs6000.c (rs6000_legitimate_address):
	Allow any offset to argument pointer in no-strict case.
	2004-03-25  David Edelsohn  <edelsohn@gnu.org>
	* config/rs6000/rs6000.c (rs6000_always_hint): New variable.
	(rs6000_sched_groups): New variable.
	(processor_target_table): Add power5.
	(rs6000_override_options): Set rs6000_sched_insert_nops,
	rs6000_sched_costly_dep and rs6000_sched_restricted_insns_priority
	from rs6000_sched_groups.
	(output_cbranch): Use rs6000_always_hint.
	(rs6000_variable_issue): Use rs6000_sched_groups.
	(rs6000_adjust_cost): Add CPU_POWER5.
	(is_microcoded_insn): Use rs6000_sched_groups.
	(is_dispatch_slot_restricted): Use rs6000_sched_groups.
	Return 2 for POWER5 cracked instructions.
	(is_cracked_insn): Use rs6000_sched_groups.
	(is_branch_slot_insn): Use rs6000_sched_groups.
	(rs6000_issue_rate): Add CPU_POWER5.
	(rs6000_sched_finish): Use rs6000_sched_groups.
	(rs6000_rtx_costs): Add PROCESSOR_POWER5.
	* config/rs6000/rs6000.h (processor_type): Add PROCESSOR_POWER5.
	* config/rs6000/rs6000.md (define_attr "cpu"): Add power5.
	* config/rs6000/power5.md: New file.
	* doc/invoke.texi: Add power5 option.
	2004-03-17  Fariborz Jahanian <fjahanian@apple.com>
	* config/rs6000/rs6000.c (rs6000_stack_info): correct reg_size
	for mixed mode.
	(rs6000_emit_prologue): Ditto.
	(rs6000_emit_epilogue): Ditto.
	* config/rs6000/rs6000.h: Definition of DWARF_CIE_DATA_ALIGNMENT
	macro for mixed mode.
	2004-03-04  David Edelsohn  <edelsohn@gnu.org>
	GP <gp@qnx.com>
	* config/rs6000/rs6000.c (output_function_profiler): Append @plt
	when compiling PIC.


Comment 12 Andrew Pinski 2004-04-30 17:05:29 UTC
Fixed in 3.4.1.