File tree 3 files changed +29
-0
lines changed
regression/ansi-c/sizeof5
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ #define STATIC_ASSERT (condition ) \
2
+ int some_array##__LINE__[(condition) ? 1 : -1];
3
+
4
+ struct S
5
+ {
6
+ int x ;
7
+ };
8
+
9
+ int main ()
10
+ {
11
+ struct S s ;
12
+ __typeof__ (* ((void * )& s .x )) * _s = & s .x ;
13
+ STATIC_ASSERT (sizeof (* _s )== 1 );
14
+ return 0 ;
15
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^warning: ignoring
8
+ ^CONVERSION ERROR$
Original file line number Diff line number Diff line change @@ -948,6 +948,12 @@ void c_typecheck_baset::typecheck_expr_sizeof(exprt &expr)
948
948
throw 0 ;
949
949
}
950
950
951
+ if (type.id ()==ID_empty &&
952
+ expr.operands ().size ()==1 &&
953
+ expr.op0 ().id ()==ID_dereference &&
954
+ expr.op0 ().op0 ().type ()==pointer_type (void_type ()))
955
+ type=char_type ();
956
+
951
957
exprt new_expr=size_of_expr (type, *this );
952
958
953
959
if (new_expr.is_nil ())
You can’t perform that action at this time.
0 commit comments