foss-for-synopsys-dwc-arc-processors / toolchain

Repository containing releases of prebuilt GNU toolchains for DesignWare ARC Processors from Synopsys (available from "releases" link below).
http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
GNU General Public License v3.0
92 stars 48 forks source link

NSIM: Test Fail pr101868 #486

Closed luismgsilva closed 1 year ago

luismgsilva commented 1 year ago

When making the comparison of ARCHS baremetal between QEMU and NSIM there is a test that is passing in QEMU but failing in NSIM.

gcc.dg/lto/pr101868 c_lto_pr101868_0.o-c_lto_pr101868_3.o execute -O2 -fno-strict-aliasing -flto

The information bellow is all the repositories and versions used in this test between both simulators.

{
      "hs-gcc-baremetal-nsim-archs": {
        "arc-gcc-baremetal": {
          "build_date": "2022-11-15 12:37:33",
          "hs-gnu-toolchain": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/arc-gnu-toolchain",
            "branch": "hs_testing",
            "hash": "3d2e8b8dc03c7358b029f3f357dc3895e97a6a25"
          },
          "gcc": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git",
            "branch": "arc64",
            "hash": "3351886ff2f2ebbf95a96b20bceda837ec159f05"
          },
          "binutils-gdb": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git",
            "branch": "arc64",
            "hash": "6f36b602c3e81742ada1f0c3cf3376daabe9d7ad"
          },
          "newlib": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/newlib.git",
            "branch": "arc64",
            "hash": "8fd57a3f456fed6c72c4750705501c72fdf05e47"
          }
        },
        "gcc": {
          "build_date": "2022-11-15 13:29:10",
          "gcc": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git",
            "branch": "arc64",
            "hash": "3351886ff2f2ebbf95a96b20bceda837ec159f05"
          }
        },
        "toolchain": {
          "build_date": "2022-11-15 13:29:10",
          "toolchain": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain.git",
            "branch": "arc-dev",
            "hash": "651008f5545ead7d1319cae8c97dc9930a8067e9"
          }
        },
        "nsim": {
          "build_version": "2022.06 (Build: 006_FREE)"
        }
      },
      "hs-gcc-baremetal-qemu-archs": {
        "arc-gcc-baremetal": {
          "build_date": "2022-11-15 12:37:33",
          "hs-gnu-toolchain": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/arc-gnu-toolchain",
            "branch": "hs_testing",
            "hash": "3d2e8b8dc03c7358b029f3f357dc3895e97a6a25"
          },
          "gcc": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git",
            "branch": "arc64",
            "hash": "3351886ff2f2ebbf95a96b20bceda837ec159f05"
          },
          "binutils-gdb": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git",
            "branch": "arc64",
            "hash": "6f36b602c3e81742ada1f0c3cf3376daabe9d7ad"
          },
          "newlib": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/newlib.git",
            "branch": "arc64",
            "hash": "8fd57a3f456fed6c72c4750705501c72fdf05e47"
          }
        },
        "gcc": {
          "build_date": "2022-11-15 13:30:12",
          "gcc": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git",
            "branch": "arc64",
            "hash": "3351886ff2f2ebbf95a96b20bceda837ec159f05"
          }
        },
        "toolchain": {
          "build_date": "2022-11-15 13:30:12",
          "toolchain": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain.git",
            "branch": "arc-dev",
            "hash": "651008f5545ead7d1319cae8c97dc9930a8067e9"
          }
        },
        "qemu": {
          "build_date": "2022-11-15 12:22:49",
          "qemu": {
            "repo": "https://github.com/foss-for-synopsys-dwc-arc-processors/qemu",
            "branch": "master",
            "hash": "7e8b35790946799be6884852377373c179434a5a"
          }
        }
      }
    }
claziss commented 1 year ago

This error may show a hidden issue with either the compiler or any of the simulators.

luismgsilva commented 1 year ago

At the time of this comment, the test case gcc.dg/lto/pr101868 is passing on both the QEMU and NSIM simulators for the ARCHS processor.

*** EXIT code 0 PASS: gcc.dg/lto/pr101868 c_lto_pr101868_0.o-c_lto_pr101868_3.o execute -O2 -fno-strict-aliasing -flto

The execution of the test case on QEMU simulator was successful, resulting in an exit code of 0.

- NSIM Execution:
```sh
Executing on host: arc-elf32-gcc c_lto_pr101868_0.o c_lto_pr101868_1.o c_lto_pr101868_2.o c_lto_pr101868_3.o    -dumpbase "" -fdiagnostics-plain-output  -O2 -fno-strict-aliasing -flto    --sp
ecs=nsim.specs -Wl,--defsym=__DEFAULT_HEAP_SIZE=256m -Wl,--defsym=__DEFAULT_STACK_SIZE=1024m  -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o    -o gcc-dg-lto-pr101
868-01.exe    (timeout = 300)
spawn -ignore SIGHUP arc-elf32-gcc c_lto_pr101868_0.o c_lto_pr101868_1.o c_lto_pr101868_2.o c_lto_pr101868_3.o -dumpbase  -fdiagnostics-plain-output -O2 -fno-strict-aliasing -flto --specs=nsi
m.specs -Wl,--defsym=__DEFAULT_HEAP_SIZE=256m -Wl,--defsym=__DEFAULT_STACK_SIZE=1024m -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -Wl,gcc_tg.o -o gcc-dg-lto-pr101868-01.exe
PASS: gcc.dg/lto/pr101868 c_lto_pr101868_0.o-c_lto_pr101868_3.o link, -O2 -fno-strict-aliasing -flto
spawn /opt/nsim/2022.06free/bin/nsimdrv -on nsim_isa_enable_timer_0 -on nsim_isa_enable_timer_1 -off invalid_instruction_interrupt -off memory_exception_interrupt -on nsim_download_elf_sectio
ns -prop=nsim_emt=1 -p nsim_isa_family=av2hs -p nsim_isa_core=3 -on nsim_isa_sat -p nsim_isa_atomic_option=1 -p nsim_isa_code_density_option=2 -p nsim_isa_div_rem_option=2 -p nsim_isa_ll64_op
tion=1 -p nsim_isa_mpy_option=2 ./gcc-dg-lto-pr101868-01.exe

*** EXIT code 0
PASS: gcc.dg/lto/pr101868 c_lto_pr101868_0.o-c_lto_pr101868_3.o execute -O2 -fno-strict-aliasing -flto

The execution of the test case on NSIM simulator was successful, resulting in an exit code of 0.

shahab-vahedi commented 1 year ago

But what changed, the user?

luismgsilva commented 1 year ago

While it is possible that the user could've been the source of the problem, the tests were executed automatically under the same configurations and environments. The only variance lies in the versions of the tools used.

However, in this particular scenario, it is the alteration made to the test itself that accounts for the disparate outcome.

The following instance reflects when the test was modified.

commit b1d0d3520e96802dee37e8fc1c56e19c13d598b1
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date:   Sun May 15 17:30:52 2022 +0300

    testsuite: Remove reliance on argc in lto/pr101868_0.c

    Some embedded targets do not pass any argv arguments.  When argc is
    zero, this causes spurious failures for lto/pr101868_0.c.  Fix by
    following the strategy in r0-114701-g2c49569ecea56d.  Use a volatile
    variable instead of argc to inject a runtime value into the test.

    I validated the following:
      - No changes in testresults for x86_64-pc-linux-gnu.
      - The spurious failures are fixed for PRU target.
      - lto/pr101868_0.c still fails on x86_64-pc-linux-gnu, if
        the PR/101868 fix (r12-2254-gfedcf3c476aff7) is reverted.

            PR tree-optimization/101868

    gcc/testsuite/ChangeLog:

            * gcc.dg/lto/pr101868_0.c (zero): New volatile variable.
            (main): Use it instead of argc.

    Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>