Bug 6466 - backend uses bad type for frame size calculation.
Summary: backend uses bad type for frame size calculation.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: 3.4.0
Assignee: Eric Botcazou
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2002-04-25 19:36 UTC by David S. Miller
Modified: 2003-11-26 09:53 UTC (History)
3 users (show)

See Also:
Host: sparc64-*-*
Target: sparc64-*-*
Build: sparc64-*-*
Known to work:
Known to fail:
Last reconfirmed: 2003-11-04 08:49:54


Attachments
bug.c (88 bytes, application/octet-stream)
2003-05-21 15:17 UTC, David S. Miller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David S. Miller 2002-04-25 19:36:00 UTC
Lots of code in the sparc backend dealing with computing
the frame size uses 'int' where HOST_WIDE_INT is more
appropriate.  The attached testcase, when compiled for
any sparc target will show the errors that result,
such as "save" instructions with an immediate operand
being a very large negative number.

Release:
GCC 3.1 CVS

Environment:
sparc-linux-gnu

How-To-Repeat:
Compile above program on Sparc, look at assembler
output or try to run the testcase :-)
Comment 1 David S. Miller 2002-04-25 19:36:00 UTC
Fix:
Make Sparc backend use HOST_WIDE_INT as appropriate.
Comment 2 David S. Miller 2002-04-25 19:36:59 UTC
Responsible-Changed-From-To: unassigned->jakub
Responsible-Changed-Why: Jakub already has a half-completed patch to deal
    with this problem post-3.1
Comment 3 Dara Hazeghi 2003-05-17 02:51:45 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: jakub@gcc.gnu.org, gcc-gnats@gcc.gnu.org, davem@redhat.com
Cc:  
Subject: Re: target/6466: [SPARC] backend uses bad types for frame size calculation.
Date: Sat, 17 May 2003 02:51:45 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=6466
 
 Hello,
 
 the report for this PR indicates that a patch was partly written in the  
 pre-3.1 era. Has there been any progress since? Is this bug still  
 present in current gcc versions? Thanks,
 
 Dara
 
Comment 4 Christian Ehrhardt 2003-05-21 09:42:44 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: .
Comment 5 Dara Hazeghi 2003-06-20 23:53:34 UTC
Dave,

any news about this bug? Was the partly written patch ever applied to gcc 3.1? Thanks,

Dara
Comment 6 Andrew Pinski 2003-08-18 04:20:28 UTC
I can confirm this is still a problem on the mainline, compute_frame_size still takes an int 
and returns an int which is wrong when on SPARC64.
Comment 7 Eric Botcazou 2003-11-04 08:49:52 UTC
This is the cause of the failure of gcc.c-torture/compile/20031023-4.c on SPARC64.
Comment 8 Eric Botcazou 2003-11-20 07:00:57 UTC
I'm testing a complete patch. Rejoice :-)
Comment 9 GCC Commits 2003-11-26 09:48:31 UTC
Subject: Bug 6466

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	ebotcazou@gcc.gnu.org	2003-11-26 09:48:22

Modified files:
	gcc            : ChangeLog 
	gcc/config/sparc: sparc-protos.h sparc.c 

Log message:
	PR target/6466
	* config/sparc/sparc-protos.h (compute_frame_size): New prototype.
	(sparc_flat_compute_frame_size): Likewise.
	(sparc_flat_save_restore): Move prototype...
	* config/sparc/sparc.c (sparc_flat_save_restore): ...here.
	(save_regs): New prototype.
	(build_big_number): Likewise.
	(apparent_fsize): Change type to HOST_WIDE_INT.
	(actual_fsize): Likewise.
	(frame_base_offset): Likewise.
	(build_big_number): Add support for HOST_BITS_PER_WIDE_INT == 64.
	Change string descriptor to HOST_WIDE_INT_PRINT_DEC.
	[TARGET_ARCH64]: Use the sequence of sparc_emit_set_const64_longway
	to load a 64-bit constant.
	(sparc_nonflat_function_prologue): Change string descriptor to
	HOST_WIDE_INT_PRINT_DEC.  Change offset type to HOST_WIDE_INT.
	(output_restore_regs): Change offset type to HOST_WIDE_INT.
	(sparc_nonflat_function_epilogue): Change string descriptor to
	HOST_WIDE_INT_PRINT_DEC.  Use build_big_number.
	(output_sibcall): Change size type to HOST_WIDE_INT.  Use
	build_big_number.  Change string descriptor to HOST_WIDE_INT_PRINT_DEC.
	(sparc_frame_info): Change types for several components.
	(sparc_flat_compute_frame_size): Update types according to previous
	change.
	(sparc_flat_function_prologue): Change string descriptor to
	HOST_WIDE_INT_PRINT_DEC.  Change offset type to int.  Use
	build_big_number.
	(sparc_flat_function_epilogue): Change offset type to int.
	Rename 'size1' into 'reg_offset1'.  Change string descriptor to
	HOST_WIDE_INT_PRINT_DEC.  Use build_big_number.  Change big number
	limit to 4096 instead of 4095.
	
	* config/sparc/sparc.c (mems_ok_for_ldd_peep): Change offset type to
	HOST_WIDE_INT.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1827&r2=2.1828
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc-protos.h.diff?cvsroot=gcc&r1=1.37&r2=1.38
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.c.diff?cvsroot=gcc&r1=1.269&r2=1.270

Comment 10 Eric Botcazou 2003-11-26 09:53:34 UTC
See http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01808.html