mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-28 16:30:59 +00:00
Allow the operand of sizeof to be an un-parenthesized compound literal.
This is allowed based on the C standard syntax, but it previously gave a spurious error in ORCA/C, because the parenthesized type name at the beginning of the compound literal was parsed as the complete operand to sizeof. Here is an example program affected by this: int main(void) { return sizeof (char[]){1,2,3}; // should return 3 }
This commit is contained in:
parent
5f59f152ed
commit
347ad00ff7
@ -2287,7 +2287,9 @@ if token.kind in startExpression then begin
|
|||||||
else if opStack^.token.kind = _Alignofsy then
|
else if opStack^.token.kind = _Alignofsy then
|
||||||
doingAlignof := true;
|
doingAlignof := true;
|
||||||
tType := TypeName;
|
tType := TypeName;
|
||||||
if doingSizeof or doingAlignof then begin
|
Match(rparench,12);
|
||||||
|
if (doingSizeof and (token.kind <> lbracech)) or doingAlignof then
|
||||||
|
begin
|
||||||
|
|
||||||
{handle a sizeof operator}
|
{handle a sizeof operator}
|
||||||
op := opStack;
|
op := opStack;
|
||||||
@ -2324,7 +2326,6 @@ if token.kind in startExpression then begin
|
|||||||
op^.next := opStack;
|
op^.next := opStack;
|
||||||
opStack := op;
|
opStack := op;
|
||||||
end; {else}
|
end; {else}
|
||||||
Match(rparench,12);
|
|
||||||
end {if}
|
end {if}
|
||||||
else begin
|
else begin
|
||||||
new(op); {record the '('}
|
new(op); {record the '('}
|
||||||
|
2
cc.notes
2
cc.notes
@ -1630,6 +1630,8 @@ If you use #pragma debug 0x0010 to enable stack check debug code, the compiler w
|
|||||||
|
|
||||||
20. When using strict type checks, == or != comparisons between a function pointer and NULL or (void*)0 would cause a spurious error.
|
20. When using strict type checks, == or != comparisons between a function pointer and NULL or (void*)0 would cause a spurious error.
|
||||||
|
|
||||||
|
21. If the operand to sizeof was a compound literal that was not enclosed in parentheses, a spurious error would be reported.
|
||||||
|
|
||||||
-- Bugs from C 2.1.1 B3 that have been fixed in C 2.2.0 ---------------------
|
-- Bugs from C 2.1.1 B3 that have been fixed in C 2.2.0 ---------------------
|
||||||
|
|
||||||
1. There were various bugs that could cause incorrect code to be generated in certain cases. Some of these were specific to certain optimization passes, alone or in combination.
|
1. There were various bugs that could cause incorrect code to be generated in certain cases. Some of these were specific to certain optimization passes, alone or in combination.
|
||||||
|
Loading…
Reference in New Issue
Block a user