Bug 42555 - [4.5 Regression] 16-byte aligned double is disallowed only in templates
Summary: [4.5 Regression] 16-byte aligned double is disallowed only in templates
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-30 18:57 UTC by benjamin.redelings
Modified: 2010-01-04 17:55 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work: 4.4.2
Known to fail: 4.5.0
Last reconfirmed: 2010-01-04 17:04:37


Attachments
A testcase. (269 bytes, text/plain)
2009-12-30 19:00 UTC, benjamin.redelings
Details

Note You need to log in before you can comment on or make changes to this bug.
Description benjamin.redelings 2009-12-30 18:57:33 UTC
The following line of code is accepted:

typedef double AlignedDoubleType __attribute__((aligned(16)));

However, if I replace 'double' with a template parameter inside a template function, then I get the following error message:

error: alignment of array elements is greater than element size

I think that the template version of the typedef should be allowed also, as it is in 4.4.
Comment 1 benjamin.redelings 2009-12-30 19:00:19 UTC
Created attachment 19425 [details]
A testcase.

To reproduce the error, compile the file (test5.C) with this command line:
% g++-4.5 -c test5.C -O3
Comment 2 benjamin.redelings 2009-12-30 19:03:49 UTC
Also, I just noticed that the error occurs only if -ftree-vectorize is turned on.
Comment 3 H.J. Lu 2010-01-01 23:48:25 UTC
It is caused by revision 155246:

http://gcc.gnu.org/ml/gcc-cvs/2009-12/msg00390.html
Comment 4 Jason Merrill 2010-01-02 23:23:35 UTC
I can't reproduce this with the current 4.5 sources.
Comment 5 H.J. Lu 2010-01-02 23:48:09 UTC
(In reply to comment #4)
> I can't reproduce this with the current 4.5 sources.
> 

I still saw it with today's gcc 4.5. You need -O3 -msse2 on
Linux/x86 to see it.
Comment 6 Jason Merrill 2010-01-04 17:53:49 UTC
Subject: Bug 42555

Author: jason
Date: Mon Jan  4 17:53:37 2010
New Revision: 155628

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155628
Log:
	PR c++/42555
	* pt.c (tsubst_decl): Don't apply type attributes in place.

Added:
    trunk/gcc/testsuite/g++.dg/ext/attrib35.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Jason Merrill 2010-01-04 17:55:38 UTC
Fixed.
Comment 8 hjl@gcc.gnu.org 2010-01-07 22:23:13 UTC
Subject: Bug 42555

Author: hjl
Date: Thu Jan  7 22:22:32 2010
New Revision: 155713

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155713
Log:
Backport tests from mainline

2010-01-07  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2010-01-06  Richard Guenther  <rguenther@suse.de>

	* gcc.c-torture/compile/pr42632.c: New testcase.

	2010-01-05  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42462
	* g++.dg/torture/pr42462.C: New test.

	2010-01-05  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/42508
	* g++.dg/opt/pr42508.C: New test.

	2010-01-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42398
	* gcc.c-torture/compile/pr42398.c: New test.

	2010-01-04  Jason Merrill  <jason@redhat.com>

	PR c++/42555
	* g++.dg/ext/attrib35.C: New.

	2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR c/42570
	* gcc.c-torture/execute/pr42570.c: New testcase.

	2010-01-01  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42559
	* gcc.c-torture/compile/pr42559.c: New testcase.

	2009-12-30  Joseph Myers  <joseph@codesourcery.com>

	PR c/42439
	* gcc.dg/bitfld-19.c: New test.

	2009-12-28  Jason Merrill  <jason@redhat.com>

	PR c++/42447
	* g++.dg/template/array21.C: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib35.C
      - copied unchanged from r155711, trunk/gcc/testsuite/g++.dg/ext/attrib35.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/pr42508.C
      - copied unchanged from r155711, trunk/gcc/testsuite/g++.dg/opt/pr42508.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/array21.C
      - copied unchanged from r155710, trunk/gcc/testsuite/g++.dg/template/array21.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42462.C
      - copied unchanged from r155711, trunk/gcc/testsuite/g++.dg/torture/pr42462.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42398.c
      - copied unchanged from r155711, trunk/gcc/testsuite/gcc.c-torture/compile/pr42398.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42559.c
      - copied unchanged from r155712, trunk/gcc/testsuite/gcc.c-torture/compile/pr42559.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42632.c
      - copied unchanged from r155710, trunk/gcc/testsuite/gcc.c-torture/compile/pr42632.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr42570.c
      - copied unchanged from r155712, trunk/gcc/testsuite/gcc.c-torture/execute/pr42570.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/bitfld-19.c
      - copied unchanged from r155710, trunk/gcc/testsuite/gcc.dg/bitfld-19.c
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog