bugTiny C Compiler - Bugs: bug #63816, tcc miscompiled test code goes...


bug #63816: tcc miscompiled test code goes from the middle of an if section into the else section (yarpgen v1)

Submitter:  Detlef Riekenberg <wine_dev>
Submitted:  Sat 18 Feb 2023 03:02:35 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Wed 08 Mar 2023 01:21:41 PM UTC, comment #1: 

Fixed by commit c771cb52fad4ea07971c2a5f178139991c6fb904
Thanks Michael Matz

There are some more yarpgen failures, but they are for new bugs.

Detlef Riekenberg <wine_dev>
Sat 18 Feb 2023 03:02:35 PM UTC, original submission:  

While trying yarpgen (v1 branch of github.com/intel/yarpgen ),
various test files compiled with tcc produce a wrong result.

the first failed testcode was created with:
yarpgen1 --std=c99  -s 5 --out-dir=./

For debugging, i added many "printf" in the testcode and found,
that the tcc compiled code changes the value of some variables.
The first change is variable "tf_1_var_118" from 95 to 0.

Code flow with line numbers in file func.c, function tf_1_foo():

1363: Both compiler reach the if (tf_1_struct_obj_3.member_1_1)
1366: Both compiler reach the "true" section of the if clause
1372: Both compiler are still in the "true" section

Now the split:
1376: Only the gcc compiled code continues in the "true" section

1396: the tcc compiled code jumped from line 1373 (inside the "true" section)
      to the start of the "false" section
1454: the tcc compiled code has changed the value of the variable
      "tf_1_var_118" from 95 to 0.

This results in a different checksum for the program.

The tcc compiled code changes some more values,
but "tf_1_var_118" is the first difference.

I used gcc as reference compiler, but clang produces the same result.

Detlef Riekenberg <wine_dev>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #54378:  00005_mod_gcc.tar.gz added by wine_dev (161KiB - application/gzip)
file #54379:  00005_scripts_with_clang.tar.gz added by wine_dev (478B - application/gzip)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by wine_dev (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-02-18 wine_dev Attached File- Added 00005_mod_gcc.tar.gz, #54378
        Attached File- Added 00005_scripts_with_clang.tar.gz, #54379

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code