Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC: xtensa: backport patch from upstream #31

Merged
merged 4 commits into from
Nov 27, 2021

Conversation

jjsuwa-sys3175
Copy link

@jjsuwa-sys3175 jjsuwa-sys3175 commented Sep 8, 2021

this PR relieves the problem (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115 and earlephilhower/newlib-xtensa#19):

gcc-mirror/gcc@b552c4e "gcc: xtensa: fix PR target/102115"

this PR relieves the problem (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115):

b552c4e601c7fdc4d341e29cc1ed6081d42b00d0 "gcc: xtensa: fix PR target/102115"
@jjsuwa-sys3175 jjsuwa-sys3175 changed the title GCC: xtensa: backport patch from upstream [WIP] GCC: xtensa: backport patch from upstream Sep 8, 2021
Makefile Outdated
@@ -254,6 +254,7 @@ configure += --enable-languages=c,c++
configure += --enable-lto
configure += --enable-static=yes
configure += --disable-libstdcxx-verbose
configure += --enable-checking=all
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense for the gcc development, but may degrade compiler performance for the end users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just testing purpose and will be reverted

with `--enable-checking=all`, earlephilhower@ed86506 surely inhibits ICE such as:
```
/tmp/esp-quick-toolchain/repo/newlib/newlib/libc/stdlib/__exp10.c:19:20: internal compiler error: RTL check: expected code 'const_int', have 'symbol_ref' in xtensa_emit_move_sequence, at config/xtensa/xtensa.c:1079
```

by the way, however, `--enable-checking=all` reveals another issue; building stops by ICE in `.stage.LINUX.libstdcpp`:
```
In file included from /tmp/esp-quick-toolchain/arena.x86_64/gcc-gnu/xtensa-lx106-elf/libstdc++-v3/include/bits/hashtable.h:35,
                 from /tmp/esp-quick-toolchain/arena.x86_64/gcc-gnu/xtensa-lx106-elf/libstdc++-v3/include/unordered_map:46,
                 from /tmp/esp-quick-toolchain/repo/gcc-gnu/libstdc++-v3/include/precompiled/stdc++.h:117:
/tmp/esp-quick-toolchain/arena.x86_64/gcc-gnu/xtensa-lx106-elf/libstdc++-v3/include/bits/hashtable_policy.h:787:23: internal compiler error: in discriminator_for_local$
      |  __throw_out_of_range(__EXCSTR(__N("_Map_base::at")));
      |                       ^~~~~~~~
0x5fe038 discriminator_for_local_entity
        /tmp/esp-quick-toolchain/repo/gcc-gnu/gcc/cp/mangle.c:1910
(snip)
```
```
static int
discriminator_for_local_entity (tree entity)
{
  if (!DECL_LANG_SPECIFIC (entity))
    {
      /* Some decls, like __FUNCTION__, don't need a discriminator.  */
      gcc_checking_assert (DECL_ARTIFICIAL (entity));
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      return 0;
    }
  else if (tree disc = DECL_DISCRIMINATOR (entity))
    return TREE_INT_CST_LOW (disc);
  else
    /* The first entity with a particular name doesn't get
       DECL_DISCRIMINATOR set up.  */
    return 0;
}
```
(https://github.com/gcc-mirror/gcc/blob/releases/gcc-10.3.0/gcc/cp/mangle.c#L1910)

but the abovementioned issue seems not to be related to this PR and should be posted as detached issue/PR, i guess.
then, this reverts commit 0b97526.
@jjsuwa-sys3175 jjsuwa-sys3175 changed the title [WIP] GCC: xtensa: backport patch from upstream GCC: xtensa: backport patch from upstream Sep 9, 2021
@earlephilhower earlephilhower merged commit aff7f1b into earlephilhower:master Nov 27, 2021
@jjsuwa-sys3175 jjsuwa-sys3175 deleted the from_upstream branch November 28, 2021 13:40
mcspr pushed a commit to esp8266/Arduino that referenced this pull request Dec 2, 2021
Fixes a hard-to-track bug in GCC 10.x.
earlephilhower/newlib-xtensa#19
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115

GCC 10.3 had an issue with addressing constant integer literals which would
result in crazy offsets being used and random crashes in production.
Update with an upstream GCC 11 bugfix by @jjsuwa-sys3175
earlephilhower/esp-quick-toolchain#31
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=dcb2873cd32b263643bfd9d1298b35d6cd028f0a
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull request Nov 18, 2024
Fixes a hard-to-track bug in GCC 10.x.
earlephilhower/newlib-xtensa#19
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102115

GCC 10.3 had an issue with addressing constant integer literals which would
result in crazy offsets being used and random crashes in production.
Update with an upstream GCC 11 bugfix by @jjsuwa-sys3175
earlephilhower/esp-quick-toolchain#31
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=dcb2873cd32b263643bfd9d1298b35d6cd028f0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants