regression: g++ produces spurious alignment errors for prototypes

Bug #295969 reported by Jens Gustedt
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Invalid
Medium
gcc-4.3 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: gcc

This appeared recently when upgrading from gutsy to intrepid. Compiling the following with g++

void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);

produdes

g++ -c -o test.o test.cc
test.cc:2: error: alignment of array elements is greater than element size

Observe the `2' in the error message, the error is reported for toto2.
(For toto1 an error would be acceptable, I think).

But even worse, if we take

void toto0(double* const (&X)[1]);
void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);

All three prototypes compile flawlessly.

This particular testing was done with 4:4.3.1-1ubuntu2 on an 8.10 amd64,
but we observed the same thing on 8.10 i386
Previously, everything was working well on 8.04.

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 8.10
Package: g++ 4:4.3.1-1ubuntu2
ProcEnviron:
 SHELL=/bin/tcsh
 PATH=/home/username/bin:/usr/bin:/usr/sbin:/bin:/usr/X11R6/bin:/usr/bin/X11:/usr/local/bin:/usr/local/bin
 LANG=de_DE.iso885915
SourcePackage: gcc-defaults
Uname: Linux 2.6.27.5 x86_64

Revision history for this message
Jens Gustedt (jens-gustedt) wrote :
Revision history for this message
In , Jens Gustedt (jens-gustedt) wrote :

[This is a copy of a bug that I posted a year ago on ubuntu's launchpad.
Nothing happened there, and now I am still observing the same problem
with gcc 4.4.1 on a newly upgraded ubuntu 9.10]

Compiling the following with g++

void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);

produdes

g++ -c -o test.o test.cc
test.cc:2: error: alignment of array elements is greater than element size

Observe the `2' in the error message, the error is reported for toto2.
(For toto1 an error would be acceptable, I think).

But even worse, if we take

void toto0(double* const (&X)[1]);
void toto1(double*const __attribute__((aligned(16))) X);
void toto2(double* const (&X)[1]);

All three prototypes compile flawlessly.

Revision history for this message
Jens Gustedt (jens-gustedt) wrote :

Still present in gcc 4.4.1 of ubuntu 9.10
I know opened a bug on gcc bugzilla:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41966

Jens

Changed in gcc:
status: Unknown → New
Revision history for this message
In , Paolo-carlini (paolo-carlini) wrote :

No errors in 4_6-branch and mainline.

Revision history for this message
In , Jens Gustedt (jens-gustedt) wrote :

Just to add to the list, since this finally found some attention.
The problem is also manifest for 4.5.2, only the difference is that this time the three line version at the end of the original report also have the error.

Changed in gcc:
importance: Unknown → Medium
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.