fixed sizeof()

This commit is contained in:
eck 1989-12-13 12:53:22 +00:00
parent a5f05e8ba0
commit 8790a879c9
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@
#include "expr.h"
#include "idf.h"
#include "def.h"
#include "sizes.h"
extern char options[];
extern arith full_mask[/*MAXSIZE*/]; /* cstoper.c */
@ -150,7 +151,7 @@ ch3mon(oper, expp)
(arith)((*expp)->SG_LEN) :
size_of_type((*expp)->ex_type,
symbol2str((*expp)->ex_type->tp_fund))
, ULONG);
, (int_size == pointer_size ? UNSIGNED : ULONG));
expr->ex_flags |= EX_SIZEOF;
free_expression(*expp);
*expp = expr;

View file

@ -16,6 +16,7 @@
#include "label.h"
#include "expr.h"
#include "code.h"
#include "sizes.h"
extern struct expr *intexpr();
int InSizeof = 0; /* inside a sizeof- expression */
@ -146,7 +147,8 @@ size_of(register struct expr **expp;)
[%if (first_of_type_specifier(AHEAD) && AHEAD != IDENTIFIER)
cast(&tp)
{
*expp = intexpr(size_of_type(tp, "type"), ULONG);
*expp = intexpr(size_of_type(tp, "type"),
(int_size == pointer_size ? UNSIGNED : ULONG));
(*expp)->ex_flags |= EX_SIZEOF;
}
|