Commit 7ec59445 by Kai Tietz Committed by Kai Tietz

offsetof.C (main): Use __SIZE_TYPE__ instead of unsigned long for pointer cast.

2008-10-01  Kai Tietz  <kai.tietz@onevision.com>

        * g++.dg/abi/offsetof.C (main): Use __SIZE_TYPE__ instead of
        unsigned long for pointer cast.
        * g++.dg/init/struct1.C: Likewise.
        * g++.dg/init/struct2.C: Likewise.
        * g++.dg/init/struct3.C: Likewise.
        * g++.dg/ext/utf-cvt.C: Correct for w64.
        * gcc.dg/utf-cvt.c: Likewise.
        * lib/target-supports.exp (check_effective_target_llp64): New.

From-SVN: r140807
parent 40ed87f7
2008-10-01 Kai Tietz <kai.tietz@onevision.com>
* g++.dg/abi/offsetof.C (main): Use __SIZE_TYPE__ instead of
unsigned long for pointer cast.
* g++.dg/init/struct1.C: Likewise.
* g++.dg/init/struct2.C: Likewise.
* g++.dg/init/struct3.C: Likewise.
* g++.dg/ext/utf-cvt.C: Correct for w64.
* gcc.dg/utf-cvt.c: Likewise.
* lib/target-supports.exp (check_effective_target_llp64): New.
2008-09-30 Simon Martin <simartin@users.sourceforge.net> 2008-09-30 Simon Martin <simartin@users.sourceforge.net>
PR c++/37555 PR c++/37555
......
...@@ -18,5 +18,5 @@ struct C: public B { }; ...@@ -18,5 +18,5 @@ struct C: public B { };
int main () int main ()
{ {
return ((unsigned long) &((C*)0)->i) != sizeof(void*); // { dg-warning "offsetof|invalid" "" } return ((__SIZE_TYPE__) &((C*)0)->i) != sizeof(void*); // { dg-warning "offsetof|invalid" "" }
} }
...@@ -46,8 +46,8 @@ void m(char16_t c0, char32_t c1) ...@@ -46,8 +46,8 @@ void m(char16_t c0, char32_t c1)
f_i (c1); /* { dg-warning "change the sign" } */ f_i (c1); /* { dg-warning "change the sign" } */
fsi (c1); /* { dg-warning "change the sign" } */ fsi (c1); /* { dg-warning "change the sign" } */
fui (c1); fui (c1);
f_l (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */ f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
fsl (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */ fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
ful (c1); ful (c1);
f_ll (c1); f_ll (c1);
fsll (c1); fsll (c1);
......
struct bug { struct bug {
const char *name; const char *name;
unsigned long type; __SIZE_TYPE__ type;
}; };
struct bug s = { 0, (unsigned long) &s | 1 }; struct bug s = { 0, (__SIZE_TYPE__) &s | 1 };
...@@ -15,7 +15,7 @@ void saveOrLoad() { ...@@ -15,7 +15,7 @@ void saveOrLoad() {
}; };
SaveLoadEntry trackEntries = { SaveLoadEntry trackEntries = {
((long) (&((Track *) 42)->soundName[0])) - 42, ((long) (__SIZE_TYPE__) (&((Track *) 42)->soundName[0])) - 42,
0, 1 0, 1
}; };
saveLoadEntries(&trackEntries); saveLoadEntries(&trackEntries);
......
...@@ -12,4 +12,4 @@ struct SaveLoadEntry { ...@@ -12,4 +12,4 @@ struct SaveLoadEntry {
int size; int size;
}; };
int foobar = ((long) (& ((Track *) 42)->soundName[0])) - 42; int foobar = ((long) (__SIZE_TYPE__) (& ((Track *) 42)->soundName[0])) - 42;
...@@ -50,8 +50,8 @@ void m (char16_t c0, char32_t c1) ...@@ -50,8 +50,8 @@ void m (char16_t c0, char32_t c1)
f_i (c1); /* { dg-warning "change the sign" } */ f_i (c1); /* { dg-warning "change the sign" } */
fsi (c1); /* { dg-warning "change the sign" } */ fsi (c1); /* { dg-warning "change the sign" } */
fui (c1); fui (c1);
f_l (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */ f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
fsl (c1); /* { dg-warning "change the sign" "" { target { ilp32 } } } */ fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
ful (c1); ful (c1);
f_ll (c1); f_ll (c1);
fsll (c1); fsll (c1);
......
...@@ -1057,6 +1057,18 @@ proc check_effective_target_lp64 { } { ...@@ -1057,6 +1057,18 @@ proc check_effective_target_lp64 { } {
}] }]
} }
# Return 1 if we're generating 64-bit code using default llp64 options,
# 0 otherwise.
proc check_effective_target_llp64 { } {
return [check_no_compiler_messages llp64 object {
int dummy[sizeof (int) == 4
&& sizeof (void *) == 8
&& sizeof (long long) == 8
&& sizeof (long) == 4 ? 1 : -1];
}]
}
# Return 1 if the target supports long double larger than double, # Return 1 if the target supports long double larger than double,
# 0 otherwise. # 0 otherwise.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment