tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks


From: grischka
Subject: Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 blocks
Date: Tue, 19 Jul 2022 13:52:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 16.07.2022 18:11, Christian JULLIEN wrote:
Hi, with mod (having your last commit),
I get this error on macOS:
/bin/sh: line 1: 32935 Segmentation fault: 11./tcctest.gcc > test.ref


Hi Christian,

seems you did use a tcc to compile tests/tcctest.c to a MACHO x86_64
executable and the executable did crash.

The tcc (I assume) you did build and install previously also from that
latest commit and probably also did run the tests on that without having
seen the problem.

If that is so then it seems that compiled executable vs. tcc -run makes
a difference.  I have no idea what it could be though.

You could try to see where tcctest crashes like so:

$ tcc -g -I. tests/tcctest.c
$ gdb a.out
  r
  bt

or using tcc's builtin stack trace:

$ tcc -bt -I. tests/tcctest.c
$ ./a.out


thanks,

-- grischka



./configure --cpu=x86_64 --config-bcheck=no --config-backtrace=no --cc=tcc 
--prefix=/Users/jullien/tinycc/static

=== /Users/jullien/local-tcc/bin/tcc

Binary directory/Users/jullien/tinycc/static/bin

TinyCC directory/Users/jullien/tinycc/static/lib/tcc

Library directory /Users/jullien/tinycc/static/lib

Include directory /Users/jullien/tinycc/static/include

Manual directory/Users/jullien/tinycc/static/share/man

Info directory/Users/jullien/tinycc/static/share/info

Doc directory /Users/jullien/tinycc/static/share/doc

/usr/include 
dir/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

Source path /Users/jullien/tinycc

C compilertcc (0.927)

Target OS Darwin

CPU x86_64

ConfigOSX dll=no bcheck=no backtrace=no

Creating config.mak and config.h

tcc -o tcc.o -c tcc.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 -DONE_SOURCE=0 
-DTCC_GITHASH="\"mob:af1abf1\"" -Wall -O2 -arch x86_64 -I.

tcc -o libtcc.o -c libtcc.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -DC2STR conftest.c -o c2str.exe && ./c2str.exe include/tccdefs.h tccdefs_.h

tcc -o tccpp.o -c tccpp.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccgen.o -c tccgen.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccdbg.o -c tccdbg.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccelf.o -c tccelf.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccasm.o -c tccasm.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccrun.o -c tccrun.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o x86_64-gen.o -c x86_64-gen.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o x86_64-link.o -c x86_64-link.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o i386-asm.o -c i386-asm.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -o tccmacho.o -c tccmacho.c 
-DCONFIG_USR_INCLUDE="\"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DCONFIG_TCC_BCHECK=0 -DCONFIG_TCC_BACKTRACE=0 
-DONE_SOURCE=0 -Wall -O2 -arch x86_64 -I.

tcc -ar rcs libtcc.a libtcc.o tccpp.o tccgen.o tccdbg.o tccelf.o tccasm.o 
tccrun.o x86_64-gen.o x86_64-link.o i386-asm.o tccmacho.o

tcc -o tcc tcc.o libtcc.a -lm -lpthread -ldl -arch x86_64

../tcc -c libtcc1.c -o libtcc1.o -B.. -I..

../tcc -c alloca.S -o alloca.o -B.. -I..

../tcc -c alloca-bt.S -o alloca-bt.o -B.. -I..

../tcc -c tcov.c -o tcov.o -B.. -I..

../tcc -c stdatomic.c -o stdatomic.o -B.. -I..

../tcc -c va_list.c -o va_list.o -B.. -I..

../tcc -ar rcs ../libtcc1.a libtcc1.o alloca.o alloca-bt.o tcov.o stdatomic.o 
va_list.o

perl ./texi2pod.pl tcc-doc.texi tcc-doc.pod

pod2man --section=1 --center="Tiny C Compiler" --release="0.9.27" tcc-doc.pod >tcc.1 
&& rm -f tcc-doc.pod

------------ hello-exe ------------

Hello World

------------ hello-run ------------

Hello World

------------ libtest ------------

Hello World!

fib(32) = 2178309

add(32, 64) = 96

------------ libtest_mt ------------

running fib with mixed calls

1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946

(15 ms)

running fib in threads

1 2 8 3 5 21 144 89 610 55 987 13 1597 233 4181 2584 10946 6765 377 34

(12 ms)

running tcc.c in threads to run fib

1 987 233 21 8 89 3 144 13 1597 55 5 2 2584 610 10946 4181 377 34 6765

(1014 ms)

compiling tcc.c 10 times

1 2 3 4 5 6 7 8 9 10

(492 ms)

/bin/sh: line 1: 32935 Segmentation fault: 11./tcctest.gcc > test.ref

make[2]: *** [test.ref] Error 139

make[2]: Target `test3' not remade because of errors.




    *Le : *16 juillet 2022 à 00:47 (GMT +02:00)
    *De : *"grischka" <grishka@gmx.de>
    *À : *"tinycc-devel@nongnu.org" <tinycc-devel@nongnu.org>
    *Objet : *Re: [Tinycc-devel] Bug that TinyCC Analyses Strings inside #if 0 
blocks


    On 13.07.2022 16:45, Ziyao wrote:
     > On Wed, Jul 13, 2022 at 12:01:57PM +0200, grischka wrote:
     >> Is it necessary or a good idea to remove that behavior/feature now
     >> from tcc?
     >> I've seen no arguments.
     >
     > Sorry for my impulsive decision.
     >
     > It is a valuable feature to be honest but supposed to be described
     > in document I think.

    To be honest, I don't know how valuable it is, or whether or not it
    might be in use by someone out there. It could be useful maybe
    with libtcc applications to wrap C-code in strings, for example.

     > As for me, I agree with Vincent and am wishing to make TinyCC throw a
     > warning in this case at least,because it seems exactly to break the
     > language rules.

    Users, as we know, are fully entitled to express their wishes freely
    as well as to call a bug whatever gets in their way and not to be
    bothered with the details.

    But: As soon as someone considers to patch the public TinyCC, he
    cannot see himself as an user merely anymore. He is expected to
    know what he is doing and to have understood what has been done
    before. (The short answer to a "Sometimes Asked Question")

    See also:
    
https://repo.or.cz/tinycc.git/commitdiff/af1abf1f45d45b34f0b02437f559f4dfdba7d23c

    -- grischka

     >
     > Ziyao

    _______________________________________________
    Tinycc-devel mailing list
    Tinycc-devel@nongnu.org
    https://lists.nongnu.org/mailman/listinfo/tinycc-devel



_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

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