Skip to content

Commit b7c4940

Browse files
committed
use ID_frontend_vector in the C front-end
The gcc vector type attribute that comes out of the C parser is not yet a full vector_typet -- thus use ID_frontend_vector to avoid the ambiguity.
1 parent cedd5ea commit b7c4940

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/ansi-c/ansi_c_convert_type.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,11 @@ void ansi_c_convert_typet::read_rec(const typet &type)
187187
{
188188
c_qualifiers.is_transparent_union=true;
189189
}
190-
else if(type.id()==ID_vector)
191-
vector_size=to_vector_type(type).size();
190+
else if(type.id() == ID_frontend_vector)
191+
{
192+
// note that this is not yet a vector_typet -- this is a size only
193+
vector_size = static_cast<const constant_exprt &>(type.find(ID_size));
194+
}
192195
else if(type.id()==ID_void)
193196
{
194197
// we store 'void' as 'empty'

src/ansi-c/parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ gcc_type_attribute:
16071607
| TOK_GCC_ATTRIBUTE_TRANSPARENT_UNION
16081608
{ $$=$1; set($$, ID_transparent_union); }
16091609
| TOK_GCC_ATTRIBUTE_VECTOR_SIZE '(' comma_expression ')'
1610-
{ $$=$1; set($$, ID_vector); parser_stack($$).add(ID_size)=parser_stack($3); }
1610+
{ $$=$1; set($$, ID_frontend_vector); parser_stack($$).add(ID_size)=parser_stack($3); }
16111611
| TOK_GCC_ATTRIBUTE_ALIGNED
16121612
{ $$=$1; set($$, ID_aligned); }
16131613
| TOK_GCC_ATTRIBUTE_ALIGNED '(' comma_expression ')'

0 commit comments

Comments
 (0)