2017-10-03 07:20:44 |
Vasco Alexandre da Silva Costa |
bug |
|
|
added bug |
2017-10-03 07:22:49 |
Vasco Alexandre da Silva Costa |
description |
This code shows the bug:
---
#include <stdio.h>
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
__extension__ unsigned long long Part[2];
} TEST_FLOAT128;
int main( void )
{
TEST_FLOAT128 tf;
printf( "alignof(tf) = %d\n",(int)__alignof__(tf) );
printf( "alignof(struct _TEST_FLOAT128) = %d\n",(int)__alignof__(struct _TEST_FLOAT128) );
printf( "alignof(TEST_FLOAT128) = %d\n",(int)__alignof__(TEST_FLOAT128) );
return 0;
}
---
$ g++-4.9 -O3 -flto -oalign test.cc -Wall -Wextra -g
# compiles without warnings.
$ g++-5 -O3 -flto -oalign test.cc -Wall -Wextra -g
1.cc:3:51: warning: type ‘struct _TEST_FLOAT128’ violates one definition rule [-Wodr]
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
^
1.cc:5:3: note: a type with different alignment is defined in another translation unit
} TEST_FLOAT128;
^
# triggers a warning. |
This code shows the bug:
---
#include <stdio.h>
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
__extension__ unsigned long long Part[2];
} TEST_FLOAT128;
int main( void )
{
TEST_FLOAT128 tf;
printf( "alignof(tf) = %d\n",(int)__alignof__(tf) );
printf( "alignof(struct _TEST_FLOAT128) = %d\n",(int)__alignof__(struct _TEST_FLOAT128) );
printf( "alignof(TEST_FLOAT128) = %d\n",(int)__alignof__(TEST_FLOAT128) );
return 0;
}
---
$ g++-4.9 -O3 -flto -oalign test.cc -Wall -Wextra -g
# compiles without warnings.
$ g++-5 -O3 -flto -oalign test.cc -Wall -Wextra -g
test.cc:3:51: warning: type ‘struct _TEST_FLOAT128’ violates one definition rule [-Wodr]
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
^
test.cc:5:3: note: a type with different alignment is defined in another translation unit
} TEST_FLOAT128;
^
# triggers a warning. |
|
2017-10-03 07:23:07 |
Vasco Alexandre da Silva Costa |
description |
This code shows the bug:
---
#include <stdio.h>
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
__extension__ unsigned long long Part[2];
} TEST_FLOAT128;
int main( void )
{
TEST_FLOAT128 tf;
printf( "alignof(tf) = %d\n",(int)__alignof__(tf) );
printf( "alignof(struct _TEST_FLOAT128) = %d\n",(int)__alignof__(struct _TEST_FLOAT128) );
printf( "alignof(TEST_FLOAT128) = %d\n",(int)__alignof__(TEST_FLOAT128) );
return 0;
}
---
$ g++-4.9 -O3 -flto -oalign test.cc -Wall -Wextra -g
# compiles without warnings.
$ g++-5 -O3 -flto -oalign test.cc -Wall -Wextra -g
test.cc:3:51: warning: type ‘struct _TEST_FLOAT128’ violates one definition rule [-Wodr]
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
^
test.cc:5:3: note: a type with different alignment is defined in another translation unit
} TEST_FLOAT128;
^
# triggers a warning. |
This code shows the bug:
---test.cc---
#include <stdio.h>
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
__extension__ unsigned long long Part[2];
} TEST_FLOAT128;
int main( void )
{
TEST_FLOAT128 tf;
printf( "alignof(tf) = %d\n",(int)__alignof__(tf) );
printf( "alignof(struct _TEST_FLOAT128) = %d\n",(int)__alignof__(struct _TEST_FLOAT128) );
printf( "alignof(TEST_FLOAT128) = %d\n",(int)__alignof__(TEST_FLOAT128) );
return 0;
}
---
$ g++-4.9 -O3 -flto -oalign test.cc -Wall -Wextra -g
# compiles without warnings.
$ g++-5 -O3 -flto -oalign test.cc -Wall -Wextra -g
test.cc:3:51: warning: type ‘struct _TEST_FLOAT128’ violates one definition rule [-Wodr]
typedef __attribute__ ((__aligned__ (16))) struct _TEST_FLOAT128 {
^
test.cc:5:3: note: a type with different alignment is defined in another translation unit
} TEST_FLOAT128;
^
# triggers a warning. |
|