[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in swit

From: Michael Matz
Subject: Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements
Date: Sun, 13 Mar 2016 02:19:26 +0100 (CET)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Sat, 12 Mar 2016, Daniel Glöckner wrote:

The issue isn't just the lack of diagnostic - what kind of erroneous code is being generated in this case?

Let's see what the final C11 draft (N1570) says about this issue:

Section paragraph 3:
The expression of each case label shall be an integer constant
expression and no two of the case constant expressions in the same
switch statement shall have the same value after conversion.

Section 4 paragraph 2:
If a "shall" or "shall not" requirement that appears outside of a
constraint or runtime-constraint is violated, the behavior is undefined.

There you read it, C11 allows us to generate whatever we want.

This is true. But you missed the detail that all constraint violations require a diagnostic (, and the above citation is a constraint on switches. So, yes, TCC is not conforming :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]