projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
should warn about struct inside parameter scope definition
[cparser]
/
ast2firm.c
diff --git
a/ast2firm.c
b/ast2firm.c
index
670c483
..
f1dc45c
100644
(file)
--- a/
ast2firm.c
+++ b/
ast2firm.c
@@
-530,7
+530,7
@@
static ir_type *create_bitfield_type(bitfield_type_t *const type)
assert(base->kind == TYPE_ATOMIC || base->kind == TYPE_ENUM);
ir_type *irbase = get_ir_type(base);
assert(base->kind == TYPE_ATOMIC || base->kind == TYPE_ENUM);
ir_type *irbase = get_ir_type(base);
- unsigned size =
fold_constant(type->size)
;
+ unsigned size =
type->bit_size
;
assert(!is_type_float(base));
if (is_type_signed(base)) {
assert(!is_type_float(base));
if (is_type_signed(base)) {
@@
-650,7
+650,7
@@
static ir_type *create_compound_type(compound_type_t *type, ir_type *irtype,
size_t base;
size_t bits_remainder;
if (entry_type->kind == TYPE_BITFIELD) {
size_t base;
size_t bits_remainder;
if (entry_type->kind == TYPE_BITFIELD) {
- size_t size_bits =
fold_constant(entry_type->bitfield.size)
;
+ size_t size_bits =
entry_type->bitfield.bit_size
;
size_t rest_size_bits = (entry_alignment - misalign)*8 - bit_offset;
if (size_bits > rest_size_bits) {
size_t rest_size_bits = (entry_alignment - misalign)*8 - bit_offset;
if (size_bits > rest_size_bits) {
@@
-807,7
+807,9
@@
static ir_type *get_ir_type(type_t *type)
ir_type *firm_type = NULL;
switch (type->kind) {
case TYPE_ERROR:
ir_type *firm_type = NULL;
switch (type->kind) {
case TYPE_ERROR:
- panic("error type occurred");
+ /* Happens while constant folding, when there was an error */
+ return create_atomic_type(&type_void->atomic);
+
case TYPE_ATOMIC:
firm_type = create_atomic_type(&type->atomic);
break;
case TYPE_ATOMIC:
firm_type = create_atomic_type(&type->atomic);
break;
@@
-4376,12
+4378,13
@@
static void for_statement_to_firm(for_statement_t *statement)
for( ; declaration != NULL; declaration = declaration->next) {
create_local_declaration(declaration);
}
for( ; declaration != NULL; declaration = declaration->next) {
create_local_declaration(declaration);
}
- declaration = statement->scope.declarations;
- for( ; declaration != NULL; declaration = declaration->next) {
- initialize_local_declaration(declaration);
- }
if (get_cur_block() != NULL) {
if (get_cur_block() != NULL) {
+ declaration = statement->scope.declarations;
+ for( ; declaration != NULL; declaration = declaration->next) {
+ initialize_local_declaration(declaration);
+ }
+
if (statement->initialisation != NULL) {
expression_to_firm(statement->initialisation);
}
if (statement->initialisation != NULL) {
expression_to_firm(statement->initialisation);
}
@@
-4572,7
+4575,7
@@
static void switch_statement_to_firm(switch_statement_t *statement)
static void case_label_to_firm(const case_label_statement_t *statement)
{
static void case_label_to_firm(const case_label_statement_t *statement)
{
- if (statement->is_empty)
+ if (statement->is_empty
_range
)
return;
dbg_info *dbgi = get_dbg_info(&statement->base.source_position);
return;
dbg_info *dbgi = get_dbg_info(&statement->base.source_position);