public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64
@ 2020-05-26 14:49 erick.ochoa@theobroma-systems.com
  2020-05-26 15:08 ` [Bug ipa/95336] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-26 14:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

            Bug ID: 95336
           Summary: Bad code gen omnetpp_r aarch64
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: erick.ochoa@theobroma-systems.com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hello,

I have been using a configuration file to compile and run CPU2017. This
configuration file worked well with gcc9, but it doesn't seem to work well with
gcc10. I am aware of the instructions outlined in "Porting to GCC 10" [0] and I
believe I have followed them. However, at least for omnetpp_r there still
seemed to be an issue. Compilation succeeded, gave several warnings (including
the following):

simulator/matchexpression.tab.cc: In function
'matchexpressionyyparse.constprop.isra':
simulator/matchexpression.tab.cc:1444:37: warning: argument 1 value
'18446744073709551615' exceeds maximum object size 9223372036854775807
[-Walloc-size-larger-than=]
 1444 |      yymsg = (char *) YYSTACK_ALLOC (yyalloc);
      |          

and immediately segfaulted.

I used the following compiler flags:

-flto -fcommon -O3

I noticed that if I reduce the optimization level to -O2, there is no segfault.

I did a bisection from

commit f47f687a97260b1a1305cbf2d7ee3d74b2916a74
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 25 17:58:56 2019 +0000

to:

commit 4945b4c2c8628bdd61b348ea5bd1f9b72537a36e (HEAD)
Author: Martin Liska <mliska@suse.cz>
Date:   Tue May 26 09:01:41 2020 +0200

and I found that the following commit may have introduced the error:

commit ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Sep 20 00:25:04 2019 +0200

I am not sure if this is a known issue or if I'm doing something wrong. 

This is the latest GCC version that I know reproduces the error:

[eochoa@osprey1 ~]$ $HOME/code/gcc-inst/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/eochoa/code/gcc-inst/bin/gcc
COLLECT_LTO_WRAPPER=/home/eochoa/code/gcc-inst/libexec/gcc/aarch64-unknown-linux-gnu/11.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /home/eochoa/code/gcc/configure --disable-bootstrap
--disable-libsanitizer --enable-__cxa_atexit --enable-shared
--disable-libsanitizer --enable-languages=c,c++,fortran --enable-lto
--enable-gold --enable-linker-build-id --with-cpu-emag
--prefix=/home/eochoa/code/gcc-inst/
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200526 (experimental) (GCC)

[0] https://gcc.gnu.org/gcc-10/porting_to.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug ipa/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
@ 2020-05-26 15:08 ` pinskia at gcc dot gnu.org
  2020-05-26 15:38 ` erick.ochoa@theobroma-systems.com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-05-26 15:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Did you try -fno-strict-aliasing?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug ipa/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
  2020-05-26 15:08 ` [Bug ipa/95336] " pinskia at gcc dot gnu.org
@ 2020-05-26 15:38 ` erick.ochoa@theobroma-systems.com
  2020-05-26 15:48 ` erick.ochoa@theobroma-systems.com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-26 15:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #2 from Erick Ochoa <erick.ochoa@theobroma-systems.com> ---
(In reply to Andrew Pinski from comment #1)
> Did you try -fno-strict-aliasing?

CXX              = $(CXX_PATH) -ggdb
TUNE_FAST        = -mtune=emag -O3
CXXOPTIMIZE      = $(TUNE_FAST) -fno-strict-aliasing
PASS1_CFLAGS     = -flto -fcommon
PASS1_CXXFLAGS   = -flto -fcommon
PASS1_FFLAGS     = -flto -fcommon
PASS1_LDFLAGS    = -flto -fcommon -fno-strict-aliasing

I originally did not. I added it as you suggested. I added it to both the
compiler and the linker just in case.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug ipa/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
  2020-05-26 15:08 ` [Bug ipa/95336] " pinskia at gcc dot gnu.org
  2020-05-26 15:38 ` erick.ochoa@theobroma-systems.com
@ 2020-05-26 15:48 ` erick.ochoa@theobroma-systems.com
  2020-05-26 15:54 ` [Bug target/95336] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-26 15:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #3 from Erick Ochoa <erick.ochoa@theobroma-systems.com> ---
(In reply to Erick Ochoa from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Did you try -fno-strict-aliasing?
> 
> CXX              = $(CXX_PATH) -ggdb
> TUNE_FAST        = -mtune=emag -O3
> CXXOPTIMIZE      = $(TUNE_FAST) -fno-strict-aliasing
> PASS1_CFLAGS     = -flto -fcommon
> PASS1_CXXFLAGS   = -flto -fcommon
> PASS1_FFLAGS     = -flto -fcommon
> PASS1_LDFLAGS    = -flto -fcommon -fno-strict-aliasing
> 
> I originally did not. I added it as you suggested. I added it to both the
> compiler and the linker just in case.

I forgot to mention that the problem still persists.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (2 preceding siblings ...)
  2020-05-26 15:48 ` erick.ochoa@theobroma-systems.com
@ 2020-05-26 15:54 ` pinskia at gcc dot gnu.org
  2020-05-26 16:23 ` erick.ochoa@theobroma-systems.com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-05-26 15:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |aarch64-linux-gnu
          Component|ipa                         |target

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Does -O2 -flto -ftree-vectorize fail also?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (3 preceding siblings ...)
  2020-05-26 15:54 ` [Bug target/95336] " pinskia at gcc dot gnu.org
@ 2020-05-26 16:23 ` erick.ochoa@theobroma-systems.com
  2020-05-26 18:18 ` jamborm at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-26 16:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #5 from Erick Ochoa <erick.ochoa@theobroma-systems.com> ---
(In reply to Andrew Pinski from comment #4)
> Does -O2 -flto -ftree-vectorize fail also?

It does not fail. I will try to narrow down the problem to an optimization
later today.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (4 preceding siblings ...)
  2020-05-26 16:23 ` erick.ochoa@theobroma-systems.com
@ 2020-05-26 18:18 ` jamborm at gcc dot gnu.org
  2020-05-26 20:12 ` erick.ochoa@theobroma-systems.com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jamborm at gcc dot gnu.org @ 2020-05-26 18:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Erick Ochoa from comment #0)

[...]

> I did a bisection from
> 
> commit f47f687a97260b1a1305cbf2d7ee3d74b2916a74
> Author: Richard Biener <rguenther@suse.de>
> Date:   Thu Apr 25 17:58:56 2019 +0000
> 
> to:
> 
> commit 4945b4c2c8628bdd61b348ea5bd1f9b72537a36e (HEAD)
> Author: Martin Liska <mliska@suse.cz>
> Date:   Tue May 26 09:01:41 2020 +0200
> 
> and I found that the following commit may have introduced the error:
> 
> commit ff6686d2e5f797d6c6a36ad14a7084bc1dc350e4
> Author: Martin Jambor <mjambor@suse.cz>
> Date:   Fri Sep 20 00:25:04 2019 +0200
> 

Can you please try the previous revision (6889a3acfee) but with option
-fno-ipa-sra ?  If it fails, it means that the previous implementation
of IPA-SRA hid some other error (we have already had an aliasing bug
like that) - in that case it would be great if you could bisect again,
this time with this option.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (5 preceding siblings ...)
  2020-05-26 18:18 ` jamborm at gcc dot gnu.org
@ 2020-05-26 20:12 ` erick.ochoa@theobroma-systems.com
  2020-05-27  7:33 ` [Bug target/95336] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-26 20:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #7 from Erick Ochoa <erick.ochoa@theobroma-systems.com> ---

I have ran revision 4945b4c2c8628bdd61b348ea5bd1f9b72537a36e with -O3 but all
-O2 and -O3 optimizations disabled except 

>   -finline-functions                          [enabled]
>   -finline-small-functions                    [enabled]

And the bug was triggered.

(In reply to Martin Jambor from comment #6)
> Can you please try the previous revision (6889a3acfee) but with option
> -fno-ipa-sra ?  If it fails, it means that the previous implementation
> of IPA-SRA hid some other error (we have already had an aliasing bug
> like that) - in that case it would be great if you could bisect again,
> this time with this option.

I ran revision 6889a3acfee

* (with) -fno-ipa-sra:                    fails
* (without) -fno-ipa-sra:                 fails

This was weird to me because the bisection should show that without
-fno-ipa-sra it should succeed. But then I used the same flags I used during
bisection which included fprofile-generate...

* (with) -fno-ipa-sra -fprofile-generate: fails
* (with) -fprofile-generate:              succeeds

Maybe using -fprofile-generate to bisect was not the correct decision? The bug
may have hidden due to the indirection provided by the profiling functions. But
at least there's evidence of different behaviour. So: yes, I'll bisect again
with minimal flags to trigger the error and let's see what happens.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] [10/11 Regression] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (6 preceding siblings ...)
  2020-05-26 20:12 ` erick.ochoa@theobroma-systems.com
@ 2020-05-27  7:33 ` rguenth at gcc dot gnu.org
  2020-05-27 11:41 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-27  7:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |10.2
            Summary|Bad code gen omnetpp_r      |[10/11 Regression] Bad code
                   |aarch64                     |gen omnetpp_r aarch64

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] [10/11 Regression] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (7 preceding siblings ...)
  2020-05-27  7:33 ` [Bug target/95336] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-05-27 11:41 ` marxin at gcc dot gnu.org
  2020-05-27 11:51 ` erick.ochoa@theobroma-systems.com
  2020-05-27 12:00 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-27 11:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-05-27
     Ever confirmed|0                           |1

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
I've just tried current gcc-10 branch tip and I can't reproduce it with:
-mtune=emag -O3 -flto=16

Can you please attach complete build log?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] [10/11 Regression] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (8 preceding siblings ...)
  2020-05-27 11:41 ` marxin at gcc dot gnu.org
@ 2020-05-27 11:51 ` erick.ochoa@theobroma-systems.com
  2020-05-27 12:00 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: erick.ochoa@theobroma-systems.com @ 2020-05-27 11:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

--- Comment #9 from Erick Ochoa <erick.ochoa@theobroma-systems.com> ---
(In reply to Martin Liška from comment #8)
> I've just tried current gcc-10 branch tip and I can't reproduce it with:
> -mtune=emag -O3 -flto=16
> 
> Can you please attach complete build log?

Hi,

I was able to get rid of the problem. Thanks for all your help and sorry for
opening this ticket. What I believe to be the reason was a mismatch between
gcc-linker or gcc-glibc installed. After rebuilding my toolchain entirely again
(and not just gcc), I have been able to successfully run omnetpp.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/95336] [10/11 Regression] Bad code gen omnetpp_r aarch64
  2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
                   ` (9 preceding siblings ...)
  2020-05-27 11:51 ` erick.ochoa@theobroma-systems.com
@ 2020-05-27 12:00 ` marxin at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-27 12:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95336

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|WAITING                     |RESOLVED

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
Good!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-27 12:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 14:49 [Bug ipa/95336] New: Bad code gen omnetpp_r aarch64 erick.ochoa@theobroma-systems.com
2020-05-26 15:08 ` [Bug ipa/95336] " pinskia at gcc dot gnu.org
2020-05-26 15:38 ` erick.ochoa@theobroma-systems.com
2020-05-26 15:48 ` erick.ochoa@theobroma-systems.com
2020-05-26 15:54 ` [Bug target/95336] " pinskia at gcc dot gnu.org
2020-05-26 16:23 ` erick.ochoa@theobroma-systems.com
2020-05-26 18:18 ` jamborm at gcc dot gnu.org
2020-05-26 20:12 ` erick.ochoa@theobroma-systems.com
2020-05-27  7:33 ` [Bug target/95336] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-05-27 11:41 ` marxin at gcc dot gnu.org
2020-05-27 11:51 ` erick.ochoa@theobroma-systems.com
2020-05-27 12:00 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).