Bug 14064 - [3.4 only] -fdata-sections triggers ICE
Summary: [3.4 only] -fdata-sections triggers ICE
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 enhancement
Target Milestone: 3.4.3
Assignee: Jim Wilson
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2004-02-07 18:44 UTC by berndtrog
Modified: 2004-09-28 01:14 UTC (History)
5 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-06-05 16:17:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description berndtrog 2004-02-07 18:44:07 UTC
/* begin test.c */
int test_1;
/* end   test.c */

$ avr-gcc -c -fdata-sections test.c

test.c:2: internal compiler error: in avr_unique_section, at config/avr/avr.c:4369
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


gcc version 3.4.0 20040207 (prerelease)
(gcc-3.3.2 has the same problem)

Note:

-ffunction-sections works realy great!
Comment 1 Andrew Pinski 2004-02-07 19:00:18 UTC
Confirmed, not a regression as the abort/fatal go all the way back from when it was added to the CVS.
Comment 2 berndtrog 2004-03-06 18:55:41 UTC
Hello,
David Gay suggested the removal of

#undef TARGET_ASM_UNIQUE_SECTION
#define TARGET_ASM_UNIQUE_SECTION avr_unique_section

in avr.c on the avr-gcc list.

This works very well for me!
I don't think it will cause any regressions with existing code.

Would this be OK for 3.4.0?
Comment 3 Eric Weddington 2004-07-20 18:56:11 UTC
Could somebody take a look at the suggestion in comment #2? Would this be ok for
3.4.2?
Comment 4 Eric Weddington 2004-08-31 17:48:55 UTC
Confirmed that the following patch works for 3.4.1:

--- gcc/config/avr/avr.c.orig2	2004-08-31 10:09:19.367125000 -0600
+++ gcc/config/avr/avr.c	2004-08-31 10:09:46.351500000 -0600
@@ -236,8 +236,6 @@
 #define TARGET_ASM_FUNCTION_EPILOGUE avr_output_function_epilogue
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE avr_attribute_table
-#undef TARGET_ASM_UNIQUE_SECTION
-#define TARGET_ASM_UNIQUE_SECTION avr_unique_section
 #undef TARGET_INSERT_ATTRIBUTES
 #define TARGET_INSERT_ATTRIBUTES avr_insert_attributes
 #undef TARGET_SECTION_TYPE_FLAGS

Since this only affects the AVR target, can this patch be approved for 3.4.3?

Thanks
Eric Weddington
Comment 5 CVS Commits 2004-09-02 01:04:29 UTC
Subject: Bug 14064

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	wilson@gcc.gnu.org	2004-09-02 01:04:23

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

Log message:
	Make -fdata-sections work for AVR port.
	PR target/14064
	* config/avr/avr.c (avr_unique_section): Delete prototype and
	definition.
	(TARGET_ASM_UNIQUE_SECTION): Delete.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5201&r2=2.5202
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/avr/avr.c.diff?cvsroot=gcc&r1=1.120&r2=1.121

Comment 6 Jim Wilson 2004-09-02 01:04:41 UTC
The suggested change is reasonable.  The AVR avr_unique_section function
predates the default_unique_section function in varasm.c which is much better,
and the avr_unique_section function has no AVR specific features, so we should
just use the default one instead.

The suggested patch is incomplete though.  There are 3 things that need to be
done.  Delete the avr_unique_section prototype, delete the avr_unique_section
function definition, and delete the TARGET_ASM_UNIQUE_SECTION definition.  Plus
the patch needs to be mailed to the gcc-patches list.

I have taken care of this, and checked in the patch to mainline.

I have not added the patch to the gcc-3.4.x branch, because technically it is
not a regression.
Comment 7 berndtrog 2004-09-24 15:25:46 UTC
>I have taken care of this, and checked in the patch to mainline.

Thanks!

>I have not added the patch to the gcc-3.4.x branch, because technically it is
>not a regression.

If it can't go into the gcc-3.4.x branch this PR should be closed, right?
Comment 8 Giovanni Bajo 2004-09-26 22:21:58 UTC
Mark,

I would very like to have this patch into 3.4. It affects only the AVR backend, 
and fixes an ICE on -fdata-section which has always been there. -fdata-section 
is very important for embedded targets, so it is an important fix for the AVR 
port. The fix does look very safe, because default_unique_section in varasm.c 
is surely much more stable.
Comment 9 Mark Mitchell 2004-09-27 06:04:15 UTC
This patch is OK for 3.4.3 if approved by the AVR maintainer.
Comment 10 Giovanni Bajo 2004-09-27 11:14:20 UTC
Thanks Mark. Denis, is it ok to apply this to 3.4?
Comment 11 denisc 2004-09-27 17:40:49 UTC
Subject: Re:  -fdata-sections triggers ICE


OK to apply. Please commit it.

Denis.

Comment 12 CVS Commits 2004-09-28 01:13:58 UTC
Subject: Bug 14064

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	giovannibajo@gcc.gnu.org	2004-09-28 01:13:55

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

Log message:
	PR target/14064
	Backport from mainline
	2004-09-01  James E Wilson  <wilson@specifixinc.com>
	* config/avr/avr.c (avr_unique_section): Delete prototype and
	definition.
	(TARGET_ASM_UNIQUE_SECTION): Delete.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.636&r2=2.2326.2.637
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/avr/avr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.108.4.2&r2=1.108.4.3

Comment 13 Giovanni Bajo 2004-09-28 01:14:34 UTC
Fixed now in both GCC 3.4.3 and GCC 4.0.0.