[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: |
Christian Jullien |
Subject: |
Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements |
Date: |
Sun, 13 Mar 2016 10:45:08 +0100 |
In ideal world, a [C] compiler should be:
- extremely fast to compile your code (i.e. very nervous development cycles)
- produce a highly optimized code for ultimate program speed
- complain about suspicious, not portable or not compliant code
Unfortunately, no compiler achieve all those goals.
- gcc has very good program speed with -O3 but is slow to compile compared
to tcc even with -O0.
- gcc is not as good as clang to analyze suspicious code and no one compares
to splint on this task.
It means serious programmers use many different tools to build their
programs.
Just on Windows, I compile my OpenLisp Lisp 33 times with 8 different
compilers using different options. I also use splint to very that my code is
strict.
Often, when I write a new feature, I prefer tcc because of its unsurpassed
compilation speed. When code seems to work, I use the complete tool chain
which includes 33 different compilations.
But, when I'm going to make a release, it is compiled 21 extra times on:
openlisp-10.2.0-AIX-powerpc.tar.gz
openlisp-10.2.0-FreeBSD-arm.tar.gz
openlisp-10.2.0-FreeBSD-x86_64.tar.gz
openlisp-10.2.0-Linux-armv6l.tar.gz
openlisp-10.2.0-Linux-armv7l.tar.gz
openlisp-10.2.0-Linux-i686.tar.gz
openlisp-10.2.0-Linux-powerpc.tar.gz
openlisp-10.2.0-Linux-powerpc64.tar.gz
openlisp-10.2.0-Linux-powerpc64le.tar.gz
openlisp-10.2.0-Linux-sparc.tar.gz
openlisp-10.2.0-Linux-sparc64.tar.gz
openlisp-10.2.0-Linux-x86_64.tar.gz
openlisp-10.2.0-NetBSD-i686.tar.gz
openlisp-10.2.0-NetBSD-x86_64.tar.gz
openlisp-10.2.0-OpenBSD-i386.tar.gz
openlisp-10.2.0-OpenBSD-x86_64.tar.gz
openlisp-10.2.0-QNX-i386.tar.gz
openlisp-10.2.0-SunOS-i386.tar.gz
openlisp-10.2.0-SunOS-sparc.tar.gz
openlisp-10.2.0-SunOS-sparc64.tar.gz
openlisp-10.2.0-SunOS-x86_64.tar.gz
What I try to explain is: use tcc for what is it good for. To me a MAJOR bug
is when a valid C program generates a wrong code or refuses to compile.
My 2c on this debate.
Christian
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Michael Matz
Sent: dimanche 13 mars 2016 02:19
To: address@hidden
Subject: Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in
switch statements
Hi,
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 6.8.4.2 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 (5.1.1.3), and the above citation is a constraint on
switches. So, yes, TCC is not conforming :)
Ciao,
Michael.
- [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, arnold, 2016/03/10
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Amine Najahi, 2016/03/11
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Michael Matz, 2016/03/11
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, arnold, 2016/03/12
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Daniel Glöckner, 2016/03/12
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Michael Matz, 2016/03/12
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements,
Christian Jullien <=
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Joel Bodenmann, 2016/03/13
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Christian Jullien, 2016/03/13
- Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Michael Matz, 2016/03/12
Re: [Tinycc-devel] MAJOR bug: tcc doesn't detect duplicate cases in switch statements, Michael B. Smith, 2016/03/11