Bug 24267

Summary: [3.4 only] Bad DWARF for altivec vectors
Product: gcc Reporter: Paul Gilliam <pgilliam>
Component: debugAssignee: Janis Johnson <janis>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, janis
Priority: P2 Keywords: wrong-debug
Version: 3.4.4   
Target Milestone: 3.4.5   
Host: Target: powerpc-linux
Build: Known to work:
Known to fail: Last reconfirmed: 2005-10-07 22:12:07

Description Paul Gilliam 2005-10-07 21:57:29 UTC
The Dwarf2 information for Altvec vectors gave _unknown_ as a base type for the vector instead of, in this case, 'short'.

Using the depricated 'attribute' scheme works, but the 'new' __vector does not, so it could be considered a regression. 

This works correctly in 4.0.0

Here is an exmple of the bad dwarf:

<0><19d>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 341
     DW_AT_high_pc     : 0x10000b08 268438280
     DW_AT_low_pc      : 0x1000051c 268436764
     DW_AT_name        : ../../../src/gdb/testsuite/gdb.arch/altivec-abi.c
     DW_AT_comp_dir    : /home/pgilliam/work/gdb-work/read-write/build/gdb/testsuite
     DW_AT_producer    : GNU C 3.4.3
     DW_AT_language    : 1      (ANSI C)
 ...
 <1><29b>: Abbrev Number: 4 (DW_TAG_array_type)
     DW_AT_sibling     : <2c2>
     DW_AT_name        : __vector signed short
     DW_AT_GNU_vector  : 1
     DW_AT_type        : <2d7>
 <2><2bb>: Abbrev Number: 5 (DW_TAG_subrange_type)
     DW_AT_type        : <2c2>
     DW_AT_upper_bound : 7
 <1><2c2>: Abbrev Number: 6 (DW_TAG_base_type)
     DW_AT_name        : long unsigned int
     DW_AT_byte_size   : 8
     DW_AT_encoding    : 7      (unsigned)
 <1><2d7>: Abbrev Number: 7 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x94): __unknown__
     DW_AT_byte_size   : 2
     DW_AT_encoding    : 5      (signed)
 ...
 <1><76a>: Abbrev Number: 14 (DW_TAG_variable)
     DW_AT_name        : vshort
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3
     DW_AT_type        : <29b>
     DW_AT_external    : 1
     DW_AT_location    : 9 byte block: 3 0 0 0 0 10 1 10 30     (DW_OP_addr: 10011030)
Comment 1 Janis Johnson 2005-10-07 22:12:07 UTC
I'm testing the backport of a fix for this.
Comment 2 GCC Commits 2005-10-08 22:24:54 UTC
Subject: Bug 24267

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	janis@gcc.gnu.org	2005-10-08 22:24:50

Modified files:
	gcc            : ChangeLog tree.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/debug/dwarf2: dwarf-altivec1.c 

Log message:
	PR debug/24267
	Partial backport from mainline
	2004-05-04 Paolo Bonzini  <bonzini@gnu.org>
	Richard Henderson  <rth@redhat.com>
	* tree.c (make_or_reuse_type): New.
	(build_common_tree_nodes): Use it.
	testsuite:
	* gcc.dg/debug/dwarf2/dwarf-altivec1.c: New test.

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.921&r2=2.2326.2.922
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.342.2.6&r2=1.342.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.439&r2=1.3389.2.440
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-altivec1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 3 Andrew Pinski 2005-10-09 14:25:51 UTC
Fixed in 3.4.5.