Hi again,

This is a follow-up to my previous patch that fixed qualified
array-type compatibility.

The previous patch makes TCC compare array element types recursively
when an unqualified comparison is required, which allows the operands
of conditional expressions involving pointers to differently-qualified
array types to be recognized as compatible.

Unfortunately, when determining the result type of the ternary
operator, TCC still combines only qualifiers stored on the outer array
nodes. Since TCC represents array qualification on the element type,
the result can lose qualifiers and depend on the order of the
operands. That's unsafe for obvious reasons.

This patch collects and combines qualifiers through any number of
levels of array type derivation. The tests attempt to modify elements
through use of the ternary operator with alternative operand orders.
Before the fix, TCC diagnoses only two of the four assignments;
afterwards it diagnoses all four.

Like the previous patch, this fix was developed with help from Codex,
but I take responsibility for it.

Please let me know the next steps I should take.

Thanks,
Christopher

Attachment: 0001-tccgen-combine-qualifiers-through-array-types.patch
Description: Binary data

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to