Bug 19885

Summary: [4.0/4.1 Regression] avr dwarf-2 support is broken for head 4.0/4.1
Product: gcc Reporter: Björn Haase <bjoern.m.haase>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: minor CC: berndtrog, eric.weddington, gcc-bugs, schlie, tsandnes, vikram.varshney
Priority: P2 Keywords: build, ice-on-valid-code
Version: 4.0.0   
Target Milestone: 4.0.2   
Host: Target: avr-*-none
Build: Known to work:
Known to fail: Last reconfirmed: 2005-06-26 18:15:15
Bug Depends on:    
Bug Blocks: 17993, 17994, 19087    
Attachments: Preprocessed source of the libgcc functions
Patch for avr.h
Patch for PR19885

Description Björn Haase 2005-02-10 23:25:15 UTC
I have just been checking out the entire gcc tree (head 4.0.0) and run a clean  
rebuild: 
 
cd build_directory 
rm -r * 
../gcc/configure --target=avr --prefix=/home/bmh --disable-nls --with-dwarf2  
--enable-languages="c" 
make all 
 
(Note that I have used --with-dwarf2!) What I am getting is :-( : 
 
../../gcc/gcc/libgcc2.c:535: internal compiler error: in simplify_subreg, at  
simplify-rtx.c:3671 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
make[2]: *** [libgcc/./_muldi3.o] Fehler 1 
make[2]: Leaving directory `/home/bmh/gnucvs/head/build/gcc' 
make[1]: *** [stmp-multilib] Fehler 2 
make[1]: Leaving directory `/home/bmh/gnucvs/head/build/gcc' 
make: *** [all-gcc] Fehler 2 
 
When building head 4.0.0 without --with-dwarf2, the build succeeds. I have  
made the same observation with last week's snapshot on another build system. 
 
Unfortunate thing is: dwarf-2 is the main debugging format for all the windows  
users that use the Atmel debugger (avr-gdb is so slow under cygwin that it is  
almost not useful to use it). 
 
Yours, 
 
Björn
Comment 1 Andrew Pinski 2005-02-10 23:31:23 UTC
Could you attach the preprocessed source (so someone like me can reproduce it without a cross 
binutils).
Comment 2 Eric Weddington 2005-02-10 23:36:54 UTC
As an aside, DWARF2 is about to become the default debugging information used in
WinAVR, for both Atmel's AVR Studio and for use with avr-gdb/avr-insight. So
this one is crucial for having a successful 4.0.0 release for the avr target.
Comment 3 Björn Haase 2005-02-10 23:45:08 UTC
Created attachment 8167 [details]
Preprocessed source of the libgcc functions

This is the command I have used for generating the attached
preprocessed file:

/home/bmh/gnucvs/head/build_dwarf/gcc/xgcc
-B/home/bmh/gnucvs/head/build_dwarf/gcc/ -B/home/bmh/avr/bin/
-B/home/bmh/avr/lib/ -isystem /home/bmh/avr/include -isystem
/home/bmh/avr/sys-include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
 -isystem ./include  -DDF=SF -Dinhibit_libc -mcall-prologues -g  -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I.-I../../gcc/gcc
-I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include 
-DL_muldi3 -E ../../gcc/gcc/libgcc2.c -o failure.E
Comment 4 Andrew Pinski 2005-02-11 01:04:37 UTC
This looks like a debugging problem, I want to say that dwar2out.c does not really support 16bit 
pointers but there was a patch a long time ago to support it.  It was applied a long time ago (1999 or 
so).

But maybe this is a target problem for not being able to output a integer for SImode size for a HImode 
pointer.
Comment 5 Björn Haase 2005-02-11 19:00:35 UTC
I have tried to trace back the date when dwarf2 support startet to fail. So far 
I have found out that it was broken already at december 5th 2004. 
 
Yours, 
 
Björn   
Comment 6 Björn Haase 2005-02-11 19:04:32 UTC
Subject: Re:  [4.0 Regression] avr dwarf-2 support is broken for head 4.0

Am Freitag, 11. Februar 2005 00:36 schrieb ericw at evcohs dot com:
> ------- Additional Comments From ericw at evcohs dot com  2005-02-10 23:36
> ------- As an aside, DWARF2 is about to become the default debugging
> information used in WinAVR, for both Atmel's AVR Studio and for use with
> avr-gdb/avr-insight. So this one is crucial for having a successful 4.0.0
> release for the avr target.

Hi Eric, 

brief question:

As far as I know you have monitored Thorleif Sandes attempts of getting the 
dwarf support working for avr-studio. Do you remember that it was necessary 
at the time to implement  bug-fixes for getting it functional for gcc 3.4. ?

Yours,

Björn
Comment 7 Torleif Sandnes 2005-03-17 06:33:21 UTC
For the 3.4.1, I am quite sure that no bugfixes were implemented to get Dwarf
support from avr-gcc. 

After configuring gcc like this:
 ./configure --enable-languages=c,c++ --target=avr --with-dwarf2 
and building it, the Dwarf support was generally ok. (Apart from the bugs I have
reported earlier)

Torleif
Comment 8 Björn Haase 2005-05-06 07:44:45 UTC
It seems that when disabling two sanity checks, one again gets head to compile 
also with dwarf2 support. The following patch might be a workaround until the 
problem is solved by addressing it's roots. 
 
Yours, 
 
Björn 
 
Index: simplify-rtx.c 
=================================================================== 
RCS file: /cvsroot/gcc/gcc/gcc/simplify-rtx.c,v 
retrieving revision 1.237 
diff -u -r1.237 simplify-rtx.c 
--- simplify-rtx.c	13 Apr 2005 19:47:28 -0000	1.237 
+++ simplify-rtx.c	6 May 2005 07:41:08 -0000 
@@ -3737,8 +3737,8 @@ 
   gcc_assert (innermode != BLKmode); 
   gcc_assert (outermode != BLKmode); 
  
-  gcc_assert (GET_MODE (op) == innermode 
-	      || GET_MODE (op) == VOIDmode); 
+//  gcc_assert (GET_MODE (op) == innermode 
+//	      || GET_MODE (op) == VOIDmode); 
  
   gcc_assert ((byte % GET_MODE_SIZE (outermode)) == 0); 
   gcc_assert (byte < GET_MODE_SIZE (innermode)); 
Index: varasm.c 
=================================================================== 
RCS file: /cvsroot/gcc/gcc/gcc/varasm.c,v 
retrieving revision 1.498 
diff -u -r1.498 varasm.c 
--- varasm.c	13 Apr 2005 14:34:13 -0000	1.498 
+++ varasm.c	6 May 2005 07:41:17 -0000 
@@ -2212,7 +2212,7 @@ 
       gcc_assert (!i); 
     } 
  
-  gcc_assert (!force); 
+  //gcc_assert (!force); 
    
   return false; 
 } 
 
Comment 9 Björn Haase 2005-05-06 14:21:00 UTC
Created attachment 8828 [details]
Patch for avr.h 

Hi,

I have traced back the origin of the bug and I think that the attached patch
should resolve the problem. In case that the patch is considered OK, I'd like
to see it in 4.0.1 as well: IMHO gcc-4.0.0 is useless for all the windows users
that use avrstudio for debugging unless this bug is resolved.

Yours,

Björn

2005-05-05  Bjoern Haase  <bjoern.m.haase@web.de>

	* config/avr/avr.h:
	(ASM_OUTPUT_DWARF_DELTA): add 
	(ASM_OUTPUT_DWARF_OFFSET): add
Comment 10 Eric Weddington 2005-05-06 15:37:35 UTC
Subject: Re:  [4.0/4.1 Regression] avr dwarf-2 support is
 broken for head 4.0/4.1

bjoern dot m dot haase at web dot de wrote:

>------- Additional Comments From bjoern dot m dot haase at web dot de  2005-05-06 14:21 -------
>Created an attachment (id=8828)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8828&action=view)
>Patch for avr.h 
>
>Hi,
>
>I have traced back the origin of the bug and I think that the attached patch
>should resolve the problem. In case that the patch is considered OK, I'd like
>to see it in 4.0.1 as well: IMHO gcc-4.0.0 is useless for all the windows users
>that use avrstudio for debugging unless this bug is resolved.
>
>Yours,
>
>Björn
>
>2005-05-05  Bjoern Haase  <bjoern.m.haase@web.de>
>
>	* config/avr/avr.h:
>	(ASM_OUTPUT_DWARF_DELTA): add 
>	(ASM_OUTPUT_DWARF_OFFSET): add 
>
>  
>
Björn,

Don't forget to send the patch to gcc-patches. You also might want to 
ping Denis Chertykov and Marek Michalkiewicz (AVR maintainters) so they 
can review and approve.

Thanks for taking the time to look into this!
Eric
Comment 11 Björn Haase 2005-05-16 20:30:04 UTC
Created attachment 8906 [details]
Patch for PR19885

The attached Patch (dwarf_patch3) is merely a copy and paste version of the
output functions from config/darwin.c that are adapted to the case of the avr
target. Tested with avr-gdb.

2005-05-16  Bjoern Haase  <bjoern.m.haase@web.de>

	* config/avr/avr.h: 
	(ASM_OUTPUT_DWARF_OFFSET): Add.
	(ASM_OUTPUT_DWARF_DELTA): Add.
	* config/avr/avr.c:
	(avr_asm_output_dwarf_delta): Add.
	(avr_asm_output_dwarf_offset): Add.
Comment 12 Björn Haase 2005-06-27 17:09:47 UTC
Subject: Re:  [4.0/4.1 Regression] avr dwarf-2 support is broken for head 4.0/4.1

Hi Andrew,

One question about gcc policy: There exists a patch resolving 19885 since a 
couple of weeks. The latest revision had been approved by Richard Henderson. 
Could you tell me what to do in order to get such a patch integrated into 
gcc? The present maintainers of the AVR port seem to be very busy at the 
moment.

Yours,

Björn
Comment 13 Steven Bosscher 2005-07-26 23:40:32 UTC
Björn, what's your .plan with the patch from comment #11? 
Comment 14 Björn Haase 2005-07-27 06:18:12 UTC
What's the plan? I'd like to see it in CVS. The patch I posted on gcc-patches  
in may 05 is already approved (it's a straight-forward change) by Richard 
Henderson.  
Unfortunately, I don't have write access to CVS. So, IIUC, the patch presently 
still waits to be committed. 
 
Yours, 
 
Björn 
Comment 15 Björn Haase 2005-07-27 06:21:09 UTC
Sorry: Let me correct myself. 
 
I just see that You have been refering to an earlier revision of the patch that 
I had posted on this bugzilla entry. This is not the current state of the 
patch. The approved  fix for this PR is posted in gcc-patches and not here! 
 
Yours, 
 
Björn 
Comment 16 Giovanni Bajo 2005-07-27 08:54:38 UTC
Bjorn, do you have a copyright assignment filed with the FSF?
Comment 17 Giovanni Bajo 2005-07-27 08:56:51 UTC
This is the patch RTH already approved for head and 4.0:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01899.html
Comment 18 Björn Haase 2005-07-27 18:30:22 UTC
>Bjorn, do you have a copyright assignment filed with the FSF? 
 
Yes. It took quite a while but since a couple of weeks the paperwork is 
finished. 
 
Comment 19 GCC Commits 2005-07-27 22:29:56 UTC
Subject: Bug 19885

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2005-07-27 22:29:47

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

Log message:
	PR target/19885
	* config/avr/avr.c (TARGET_ASM_ALIGNED_SI_OP): Add.
	(TARGET_ASM_UNALIGNED_HI_OP): Add.
	(TARGET_ASM_UNALIGNED_SI_OP): Add.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9570&r2=2.9571
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/avr/avr.c.diff?cvsroot=gcc&r1=1.140&r2=1.141

Comment 20 GCC Commits 2005-07-27 23:37:17 UTC
Subject: Bug 19885

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	giovannibajo@gcc.gnu.org	2005-07-27 23:37:13

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

Log message:
	PR target/19885
	* config/avr/avr.c (TARGET_ASM_ALIGNED_SI_OP): Add.
	(TARGET_ASM_UNALIGNED_HI_OP): Add.
	(TARGET_ASM_UNALIGNED_SI_OP): Add.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.333&r2=2.7592.2.334
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/avr/avr.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.129.6.3&r2=1.129.6.4

Comment 21 Giovanni Bajo 2005-07-27 23:37:48 UTC
Fixed for GCC 4.0.2 and GCC 4.1.0.
Comment 22 Andrew Pinski 2008-11-07 02:14:03 UTC
*** Bug 38029 has been marked as a duplicate of this bug. ***
Comment 23 Jackie Rosen 2014-02-16 13:17:35 UTC Comment hidden (spam)