public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/67920] New: wrong code with -O3
@ 2015-10-10 19:46 jamrial at gmail dot com
  2015-10-10 20:01 ` [Bug rtl-optimization/67920] " jamrial at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-10 19:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67920
           Summary: wrong code with -O3
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamrial at gmail dot com
  Target Milestone: ---

Some change to trunk made in the last 18 days is making gcc miscompile the
files libavcodec/jpeg2000dec.c libavcodec/j2kenc.c and libavcodec/avuidec.c
from ffmpeg git head when -O3 is used. This doesn't happen with -O2.
I tested with x86_64-pc-linux-gnu only.

How to reproduce:
git clone git://git.videolan.org/ffmpeg.git && cd ffmpeg && ./configure
make fate-vsynth1-jpeg2000 fate-vsynth1-avui

The tests will fail, the former showing both the encoder and decoder are
producing garbage, and the latter only the decoder. Adding -fno-strict-aliasing
-fwrapv does not make a difference.

The command Makefile uses to compile all three files looks like this:
gcc -I. -I/home/jamrial/ffmpeg/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DZLIB_CONST
-DHAVE_AV_CONFIG_H -std=c99 -fomit-frame-pointer -pthread -g
-Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith
-Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes
-Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses
-Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno
-fno-signed-zeros -fno-tree-vectorize -Werror=format-security
-Werror=implicit-function-declaration -Werror=missing-prototypes
-Werror=return-type -Werror=vla -Wformat -fdiagnostics-color=auto
-Wno-maybe-uninitialized -c -o OUTPUT.o INPUT.c

You can get that kind of verbose output by running make with V=1.
Keep in mind you'll probably run into pr67794 while bisecting gcc trunk to find
the commit that introduced this regression.

Apologizes for not having a simpler test case.


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

* [Bug rtl-optimization/67920] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
@ 2015-10-10 20:01 ` jamrial at gmail dot com
  2015-10-10 20:08 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-10 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from James Almer <jamrial at gmail dot com> ---
For reference you can also check
http://fate.ffmpeg.org/report.cgi?time=20151010052205&slot=x86_64-archlinux-gcc-experimental


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

* [Bug rtl-optimization/67920] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
  2015-10-10 20:01 ` [Bug rtl-optimization/67920] " jamrial at gmail dot com
@ 2015-10-10 20:08 ` pinskia at gcc dot gnu.org
  2015-10-10 21:00 ` jamrial at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-10-10 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you also compile with -fsanitize=undefined and try that?  Can you also try
-fsanitize=address ?

This might detect if it is a bug in the code vs a bug in GCC.


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

* [Bug rtl-optimization/67920] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
  2015-10-10 20:01 ` [Bug rtl-optimization/67920] " jamrial at gmail dot com
  2015-10-10 20:08 ` pinskia at gcc dot gnu.org
@ 2015-10-10 21:00 ` jamrial at gmail dot com
  2015-10-12  7:43 ` [Bug rtl-optimization/67920] [6 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-10 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from James Almer <jamrial at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> Can you also compile with -fsanitize=undefined and try that?  Can you also
> try -fsanitize=address ?
> 
> This might detect if it is a bug in the code vs a bug in GCC.

Can't check with gcc 6 because of pr67921, but asan/ubsan in gcc 5.2.0 and
clang 3.1 apparently don't complain about the code.

ubsan gcc 5.2.0:
http://fate.ffmpeg.org/report.cgi?time=20151010033356&slot=x86_64-archlinux-gcc-ubsan
asan gcc 5.2.0:
http://fate.ffmpeg.org/report.cgi?time=20151010181435&slot=x86_64-archlinux-gcc-asan
Clang 3.1 asan:
http://fate.ffmpeg.org/report.cgi?time=20151010171909&slot=x86_64-debian-asan-144800


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

* [Bug rtl-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (2 preceding siblings ...)
  2015-10-10 21:00 ` jamrial at gmail dot com
@ 2015-10-12  7:43 ` rguenth at gcc dot gnu.org
  2015-10-13  0:17 ` [Bug tree-optimization/67920] " jamrial at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-12  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-10-12
   Target Milestone|---                         |6.0
            Summary|wrong code with -O3         |[6 Regression] wrong code
                   |                            |with -O3
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Waiting for sth like a testcase.


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

* [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (3 preceding siblings ...)
  2015-10-12  7:43 ` [Bug rtl-optimization/67920] [6 Regression] " rguenth at gcc dot gnu.org
@ 2015-10-13  0:17 ` jamrial at gmail dot com
  2015-10-13  0:18 ` jamrial at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-13  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

James Almer <jamrial at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |tree-optimization

--- Comment #5 from James Almer <jamrial at gmail dot com> ---
This is a regression introduced by r228599.
I'm attaching the output of -save-temps for all three files, the good assembly
from r228598 (last good commit) and the bad assembly from r228599.

I can't generate a better or simpler testcase, sorry.


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

* [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (4 preceding siblings ...)
  2015-10-13  0:17 ` [Bug tree-optimization/67920] " jamrial at gmail dot com
@ 2015-10-13  0:18 ` jamrial at gmail dot com
  2015-10-13 10:43 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-13  0:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from James Almer <jamrial at gmail dot com> ---
Created attachment 36491
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36491&action=edit
-save-temps output for all three files


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

* [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (5 preceding siblings ...)
  2015-10-13  0:18 ` jamrial at gmail dot com
@ 2015-10-13 10:43 ` mpolacek at gcc dot gnu.org
  2015-10-13 13:11 ` ysrumyan at gmail dot com
  2015-10-13 17:00 ` jamrial at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-10-13 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This should be the same as PR67947 which has a testcase.


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

* [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (6 preceding siblings ...)
  2015-10-13 10:43 ` mpolacek at gcc dot gnu.org
@ 2015-10-13 13:11 ` ysrumyan at gmail dot com
  2015-10-13 17:00 ` jamrial at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: ysrumyan at gmail dot com @ 2015-10-13 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Yuri Rumyantsev <ysrumyan at gmail dot com> ---
Please check that revision 228760 will cure your issue.


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

* [Bug tree-optimization/67920] [6 Regression] wrong code with -O3
  2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
                   ` (7 preceding siblings ...)
  2015-10-13 13:11 ` ysrumyan at gmail dot com
@ 2015-10-13 17:00 ` jamrial at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: jamrial at gmail dot com @ 2015-10-13 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from James Almer <jamrial at gmail dot com> ---
(In reply to Yuri Rumyantsev from comment #8)
> Please check that revision 228760 will cure your issue.

Looks like it did. Thanks.


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

end of thread, other threads:[~2015-10-13 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-10 19:46 [Bug rtl-optimization/67920] New: wrong code with -O3 jamrial at gmail dot com
2015-10-10 20:01 ` [Bug rtl-optimization/67920] " jamrial at gmail dot com
2015-10-10 20:08 ` pinskia at gcc dot gnu.org
2015-10-10 21:00 ` jamrial at gmail dot com
2015-10-12  7:43 ` [Bug rtl-optimization/67920] [6 Regression] " rguenth at gcc dot gnu.org
2015-10-13  0:17 ` [Bug tree-optimization/67920] " jamrial at gmail dot com
2015-10-13  0:18 ` jamrial at gmail dot com
2015-10-13 10:43 ` mpolacek at gcc dot gnu.org
2015-10-13 13:11 ` ysrumyan at gmail dot com
2015-10-13 17:00 ` jamrial at gmail dot com

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).