public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template
@ 2005-01-18 16:44 jan at etpmod dot phys dot tue dot nl
  2005-01-18 17:18 ` [Bug c++/19508] [4.0 " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jan at etpmod dot phys dot tue dot nl @ 2005-01-18 16:44 UTC (permalink / raw)
  To: gcc-bugs

When compiled with -g the following reduced testcase causes an ICE (see output 
below), without -g everything is fine. I noticed report PR19163 which exposes 
other (unrelated?) __attribute__(aligned) problems. This is a 3.4 regression. 
 
This is with today's trunk, configured without options (except --prefix). 
  
template <typename T>  
struct BVector  
{  
  typedef T value_type __attribute__ ((aligned(8)));  
};  
BVector<int> m;  
  
  
jan@nbelvis$ g++ -c luinvert.ii  
jan@nbelvis$ g++ -g -c luinvert.ii  
luinvert.ii: In instantiation of ?BVector<int>?:  
luinvert.ii:6:   instantiated from here  
luinvert.ii:3: internal compiler error: in is_base_type, at dwarf2out.c:8058  
...

-- 
           Summary: [3.4 regression] dwarf2, ICE on __attribute__(aligned)
                    in class template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at etpmod dot phys dot tue dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-suse-linux
  GCC host triplet: i686-suse-linux
GCC target triplet: i686-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
@ 2005-01-18 17:18 ` pinskia at gcc dot gnu dot org
  2005-01-18 17:20 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-18 17:18 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at gcc dot gnu
                   |                            |dot org, pinskia at gcc dot
                   |                            |gnu dot org
           Keywords|                            |ice-on-valid-code
            Summary|[3.4 regression] dwarf2, ICE|[4.0 regression] dwarf2, ICE
                   |on __attribute__(aligned) in|on __attribute__(aligned) in
                   |class template              |class template
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
  2005-01-18 17:18 ` [Bug c++/19508] [4.0 " pinskia at gcc dot gnu dot org
@ 2005-01-18 17:20 ` pinskia at gcc dot gnu dot org
  2005-01-18 17:33 ` pcarlini at suse dot de
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-18 17:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-18 17:20 -------
: Search converges between 2004-10-17-014001-trunk (#594) and 2004-10-17-161001-trunk 
(#595).

Almost definetly caused by:
2004-10-17  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
        
        PR c++/17743
        * decl2.c (grokfield): Apply attributes also to TYPE_DECLs.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-18 17:20:18
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
  2005-01-18 17:18 ` [Bug c++/19508] [4.0 " pinskia at gcc dot gnu dot org
  2005-01-18 17:20 ` pinskia at gcc dot gnu dot org
@ 2005-01-18 17:33 ` pcarlini at suse dot de
  2005-01-20  4:25 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pcarlini at suse dot de @ 2005-01-18 17:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-01-18 17:32 -------
A remark: this specific issue doesn't seem to affect the minimal usage of
__attribute__((aligned)) present in tr1/type_traits (no typedefs): if/when
fixing this problem, *please* make sure to regtest libstdc++-v3!

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pcarlini at suse dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (2 preceding siblings ...)
  2005-01-18 17:33 ` pcarlini at suse dot de
@ 2005-01-20  4:25 ` pinskia at gcc dot gnu dot org
  2005-01-20  4:36 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-20  4:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-20 04:25 -------
We get <<< Unknown tree: template_type_parm >>> in is_base_type, that seems wrong

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (3 preceding siblings ...)
  2005-01-20  4:25 ` pinskia at gcc dot gnu dot org
@ 2005-01-20  4:36 ` pinskia at gcc dot gnu dot org
  2005-01-20 12:10 ` giovannibajo at libero dot it
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-20  4:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-20 04:36 -------
Hmm, after applying the attributes we get:
<type_decl 0x41da41d0 value_type
    type <template_type_parm 0x41da42b8 value_type type_0 type_6 VOID
        user align 64 symtab 0 alias set -1
       index 0 level 1 orig_level 1>
    nonlocal VOID file t.cc line 4
    align 1 context <record_type 0x41d9ce0c BVector<T>> attributes <tree_list 0x41da3438>
    result <template_type_parm 0x41d9cd24 T type_0 type_6 VOID
        align 8 symtab 0 alias set -1
       index 0 level 1 orig_level 1
        chain <type_decl 0x41d9cd98 T>>
   >

Notice how we have a copy in TREE_TYPE, the orginal which we would have done correctly is in 
DECL_ORIGINAL_TYPE.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-01-18 17:20:18         |2005-01-20 04:36:26
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (4 preceding siblings ...)
  2005-01-20  4:36 ` pinskia at gcc dot gnu dot org
@ 2005-01-20 12:10 ` giovannibajo at libero dot it
  2005-01-20 12:19 ` giovannibajo at libero dot it
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2005-01-20 12:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-01-20 12:09 -------
The problem here is that tsubst does not know about attributes, and we knew 
this already. So it won't look into DECL_ORIGINAL_TYPE because it assumes it is 
always NULL for template parameters. You may want to notice that the attribute 
is in fact ignored:

--------------------------------------------------------
template <typename T>  
struct BVector  
{  
  typedef T value_type __attribute__ ((aligned(8)));  
  value_type v;
};  
BVector<int> m;  

int main()
{
  printf("%d\n", __alignof__(m.v));
}
--------------------------------------------------------

This prints "4" on i686-pc-linux-gnu (if you compile it without -g to avoid the 
ICE).

I tried tsubsting within the ORIGINAL_TYPE of a TYPE_DECL too, and it works in 
avoiding the ICE, but for nothing else. Also, the long-term solution is to not 
apply attributes to template types, store the attribute list aside and apply it 
after substitution. So, after all, this would not be a step forward not even in 
that direction.

Thus, it is better to simply not apply the attribute to template types at all.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |giovannibajo at libero dot
                   |dot org                     |it
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-01-20 04:36:26         |2005-01-20 12:09:35
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (5 preceding siblings ...)
  2005-01-20 12:10 ` giovannibajo at libero dot it
@ 2005-01-20 12:19 ` giovannibajo at libero dot it
  2005-01-20 12:26 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2005-01-20 12:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-01-20 12:19 -------
Paolo, I think I'm going to have a warning like this:

19508.cc:7: warning: cannot apply attributes to template parameter 'T'

for the time being, to warn the user that the attribute is being ignored. I 
hope this does not conflict with some of yours TR1 plans.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (6 preceding siblings ...)
  2005-01-20 12:19 ` giovannibajo at libero dot it
@ 2005-01-20 12:26 ` pcarlini at suse dot de
  2005-01-20 12:33 ` pcarlini at suse dot de
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pcarlini at suse dot de @ 2005-01-20 12:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-01-20 12:26 -------
> Paolo, I think I'm going to have a warning like this:

Well, if I understand well the current status, we *must* warn the user about
that. And, of course, I believe the current (for 4.0, that is) usage in tr1/
type_traits will *not* trigger the warning, because is ok. Indeed, I see the
alignment request respected in this kind of situation:

  template<std::size_t _Len>
    struct aligned_storage<_Len, 1>
    {
      union type
      {
	unsigned char __data[_Len];
	char __align __attribute__((aligned(1)));
      };
    };

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (7 preceding siblings ...)
  2005-01-20 12:26 ` pcarlini at suse dot de
@ 2005-01-20 12:33 ` pcarlini at suse dot de
  2005-01-20 14:05 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pcarlini at suse dot de @ 2005-01-20 12:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-01-20 12:32 -------
Anyway, just regtest libstdc++-v3, as I already said: by now we have plenty
of the above usage and plenty of tests. Either at compile time or at run time
something will show up, in case.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (8 preceding siblings ...)
  2005-01-20 12:33 ` pcarlini at suse dot de
@ 2005-01-20 14:05 ` giovannibajo at libero dot it
  2005-02-18 23:11 ` cvs-commit at gcc dot gnu dot org
  2005-02-18 23:11 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2005-01-20 14:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-01-20 14:05 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01325.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (10 preceding siblings ...)
  2005-02-18 23:11 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-18 23:11 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-18 23:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-18 19:14 -------
The ICE itself is fixed and the rest of the bug is referenced in PR 17743 so closing as fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/19508] [4.0 regression] dwarf2, ICE on __attribute__(aligned) in class template
  2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
                   ` (9 preceding siblings ...)
  2005-01-20 14:05 ` giovannibajo at libero dot it
@ 2005-02-18 23:11 ` cvs-commit at gcc dot gnu dot org
  2005-02-18 23:11 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-18 23:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-02-18 19:12 -------
Subject: Bug 19508

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2005-02-18 19:11:58

Modified files:
	gcc/cp         : ChangeLog decl2.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: attrib20.C 

Log message:
	2005-01-20  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
	
	PR c++/19508
	* g++.dg/ext/attrib20.C: New test.
	
	2005-01-20  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
	
	PR c++/19508
	* decl2.c (grokfield): Do not apply attributes to template parameters
	as they are ignored by tsubst anyway.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4634&r2=1.4635
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.766&r2=1.767
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5048&r2=1.5049
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib20.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19508


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-02-18 19:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-18 16:44 [Bug c++/19508] New: [3.4 regression] dwarf2, ICE on __attribute__(aligned) in class template jan at etpmod dot phys dot tue dot nl
2005-01-18 17:18 ` [Bug c++/19508] [4.0 " pinskia at gcc dot gnu dot org
2005-01-18 17:20 ` pinskia at gcc dot gnu dot org
2005-01-18 17:33 ` pcarlini at suse dot de
2005-01-20  4:25 ` pinskia at gcc dot gnu dot org
2005-01-20  4:36 ` pinskia at gcc dot gnu dot org
2005-01-20 12:10 ` giovannibajo at libero dot it
2005-01-20 12:19 ` giovannibajo at libero dot it
2005-01-20 12:26 ` pcarlini at suse dot de
2005-01-20 12:33 ` pcarlini at suse dot de
2005-01-20 14:05 ` giovannibajo at libero dot it
2005-02-18 23:11 ` cvs-commit at gcc dot gnu dot org
2005-02-18 23:11 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).