[Top][All Lists]

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

Re: [Tinycc-devel] Lexer conditionally doesn't require "case" in "switch

From: Michael Matz
Subject: Re: [Tinycc-devel] Lexer conditionally doesn't require "case" in "switch"
Date: Wed, 9 Nov 2016 15:52:27 +0100 (CET)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)


On Tue, 8 Nov 2016, Steffen Nurpmeso wrote:

> a tcc(1) compiled on June 6th as well as one of [mob:3054a76] (as
> well as one of [master], accidentally) fails to fail on the
> attached file.

The file being:

enum{ a_0, a_1, a255 };
main(int argc, char **argv){
        a_0: return 0;
        a_1: return 1;
        a_255: return 255;

Why should it fail?  This is valid (albeit silly) code with three dead 
labelled statements.  switch cases are nothing else than normal labeled 
statements (with a special label, though), and nothing says that a switch 
must have any cases.  Also the namespaces for labels and decls are 
separate, so it's also valid to have enums and labels of the same name.


reply via email to

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