[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/3276] New: Alignment error with static const variable in i
From: |
jespdj at hotmail dot com |
Subject: |
[Bug binutils/3276] New: Alignment error with static const variable in inline function |
Date: |
28 Sep 2006 07:42:45 -0000 |
I initially entered this bug in the GCC bug database, but the bug seems not to
be in GCC, but probably in binutils. See GCC bug 29249:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29249
The problem is this: I have a small C++ program that requires an int to be
aligned on a 16 byte boundary. When I compile and run this program with g++
version 4.1.1 and binutils version 2.17.50 on Cygwin, I get an alignment error
(the int is not aligned on a 16 byte boundary).
g++ outputs the correct assembler code, so the error must be in as or ld.
This is the source code:
// ----- begin source code
#include <stdio.h>
typedef int __attribute__ ((aligned (16))) aint;
inline void function() {
static const aint x = 123;
printf("sizeof(x) = %d, __alignof__(x) = %d\n", sizeof(x), __alignof__(x));
unsigned long a = (unsigned long) &x;
printf("Address of x: 0x%lX - %s\n", a, a & 15L ? "ALIGNMENT ERROR" : "ok");
}
int main() {
function();
return 0;
}
// ----- end source code
I compile this using the following command:
g++ tst.cpp -o tst
The output when running the program is:
Address of x: 0x40E3E8 - ALIGNMENT ERROR
I will attach the assembler code produced by GCC.
--
Summary: Alignment error with static const variable in inline
function
Product: binutils
Version: 2.17
Status: NEW
Severity: normal
Priority: P2
Component: binutils
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: jespdj at hotmail dot com
CC: bug-binutils at gnu dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=3276
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug binutils/3276] New: Alignment error with static const variable in inline function,
jespdj at hotmail dot com <=
- [Bug binutils/3276] Alignment error with static const variable in inline function, jespdj at hotmail dot com, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, jespdj at hotmail dot com, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, jespdj at hotmail dot com, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, jespdj at hotmail dot com, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, pinskia at gcc dot gnu dot org, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, wilson at specifix dot com, 2006/09/28
- Re: [Bug binutils/3276] New: Alignment error with static const variable in inline function, Jim Wilson, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, dannysmith at users dot sourceforge dot net, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, dannysmith at users dot sourceforge dot net, 2006/09/28
- [Bug binutils/3276] Alignment error with static const variable in inline function, dannysmith at users dot sourceforge dot net, 2006/09/28