public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
@ 2014-11-28 21:16 zsojka at seznam dot cz
  2014-11-29 14:07 ` [Bug target/64108] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2014-11-28 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64108
           Summary: ICE: SIGSEGV in decide_alg() with
                    -mmemset-strategy=libcall:-1:align
                    -minline-all-stringops
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 34134
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34134&action=edit
preprocessed source (gcc.target/i386/memset-strategy-1.c)

Compiler output:
$ gcc -mmemset-strategy=libcall:-1:align -minline-all-stringops
memset-strategy-1.i -wrapper valgrind,-q
==13391== Stack overflow in thread 1: can't grow stack to 0xffe001ff8
==13391== Can't extend stack to 0xffe0010a8 during signal delivery for thread
1:
==13391==   no stack segment
==13391== 
==13391== Process terminating with default action of signal 11 (SIGSEGV)
==13391==  Access not within mapped region at address 0xFFE0010A8
==13391==    at 0xF047D2: decide_alg(long, long, unsigned long, unsigned long,
bool, bool, int*, bool*) (i386.c:24370)
==13391==  If you believe this happened as a result of a stack
==13391==  overflow in your program's main thread (unlikely but
==13391==  possible), you can try to increase the size of the
==13391==  main thread stack using the --main-stacksize= flag.
==13391==  The main thread stack size used in this run was 16777216.
==13391== Stack overflow in thread 1: can't grow stack to 0xffe001f71
==13391== 
==13391== Process terminating with default action of signal 11 (SIGSEGV)
==13391==  Access not within mapped region at address 0xFFE001F71
==13391==    at 0x4A236B0: _vgnU_freeres (in
/usr/lib64/valgrind/vgpreload_core-amd64-linux.so)
==13391==  If you believe this happened as a result of a stack
==13391==  overflow in your program's main thread (unlikely but
==13391==  possible), you can try to increase the size of the
==13391==  main thread stack using the --main-stacksize= flag.
==13391==  The main thread stack size used in this run was 16777216.
gcc: internal compiler error: Segmentation fault (program valgrind)
0x40bff5 execute
        /mnt/svn/gcc-trunk/gcc/gcc.c:2912
0x40c289 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:4841
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
0x40d287 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5495
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
0x40d287 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5495
0x40c613 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5610
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
0x40d287 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5495
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
0x40d287 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5495
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
0x40d287 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5495
0x40e887 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:6124
0x40e887 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:6038
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r218137 - ICE
4_9 r216937 - ICE


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

* [Bug target/64108] ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
  2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
@ 2014-11-29 14:07 ` hjl.tools at gmail dot com
  2014-12-02 14:11 ` hjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-29 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |4.9.3


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

* [Bug target/64108] ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
  2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
  2014-11-29 14:07 ` [Bug target/64108] " hjl.tools at gmail dot com
@ 2014-12-02 14:11 ` hjl at gcc dot gnu.org
  2014-12-04  5:13 ` zsojka at seznam dot cz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-02 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Tue Dec  2 14:10:23 2014
New Revision: 218272

URL: https://gcc.gnu.org/viewcvs?rev=218272&root=gcc&view=rev
Log:
Stop only if there aren't any usable algorithms

When searching for an usable algorithm with -minline-all-stringops,
decide_alg stops when it sees libcall even if there is a usable
algorithm.  It goes into an infinite loop.  This patch changes
decide_alg to stop searching only if there aren't any usable algorithms.
Testd on Linux/x86-64.


gcc/

    PR target/64108
    * config/i386/i386.c (decide_alg): Stop only if there aren't
    any usable algorithms.

gcc/testsuite/

    PR target/64108
    * gcc.target/i386/memset-strategy-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/64108] ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
  2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
  2014-11-29 14:07 ` [Bug target/64108] " hjl.tools at gmail dot com
  2014-12-02 14:11 ` hjl at gcc dot gnu.org
@ 2014-12-04  5:13 ` zsojka at seznam dot cz
  2014-12-05 11:53 ` hjl at gcc dot gnu.org
  2014-12-05 12:05 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2014-12-04  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Zdenek Sojka <zsojka at seznam dot cz> ---
Created attachment 34187
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34187&action=edit
another autoreduced testcase (from gcc.c-torture/execute/20020412-1.c)

Hello, I am getting another similiar ICE (-minline-stringops-dynamically is
used it this case, different testcase):

$ gcc -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically final.i 
final.i: In function 'foo':
final.i:10:5: internal compiler error: in decide_alg, at
config/i386/i386.c:24506
   d = 
     ^
0xf0f862 decide_alg
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:24506
0xf5848f ix86_expand_set_or_movmem(rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, bool)
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:24759
0x106b68e gen_movmemdi(rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.md:15893
0xb18792 insn_gen_fn::operator()(rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*) const
        /mnt/svn/gcc-trunk/gcc/recog.h:310
0xb18792 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        /mnt/svn/gcc-trunk/gcc/optabs.c:8395
0xb18da8 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        /mnt/svn/gcc-trunk/gcc/optabs.c:8407
0x8d8a3e emit_block_move_via_movmem
        /mnt/svn/gcc-trunk/gcc/expr.c:1330
0x8d8a3e emit_block_move_hints(rtx_def*, rtx_def*, rtx_def*, block_op_methods,
unsigned int, long, unsigned long, unsigned long, unsigned long)
        /mnt/svn/gcc-trunk/gcc/expr.c:1148
0x797721 expand_builtin_memcpy_args
        /mnt/svn/gcc-trunk/gcc/builtins.c:3243
0x7a746c expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        /mnt/svn/gcc-trunk/gcc/builtins.c:6288
0x8d45b6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /mnt/svn/gcc-trunk/gcc/expr.c:10471
0x7cb4c9 expand_expr
        /mnt/svn/gcc-trunk/gcc/expr.h:299
0x7cb4c9 expand_call_stmt
        /mnt/svn/gcc-trunk/gcc/cfgexpand.c:2347
0x7cbbff expand_gimple_stmt_1
        /mnt/svn/gcc-trunk/gcc/cfgexpand.c:3293
0x7cbbff expand_gimple_stmt
        /mnt/svn/gcc-trunk/gcc/cfgexpand.c:3447
0x7d1193 expand_gimple_basic_block
        /mnt/svn/gcc-trunk/gcc/cfgexpand.c:5280
0x7d3686 execute
        /mnt/svn/gcc-trunk/gcc/cfgexpand.c:5889
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug target/64108] ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
  2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2014-12-04  5:13 ` zsojka at seznam dot cz
@ 2014-12-05 11:53 ` hjl at gcc dot gnu.org
  2014-12-05 12:05 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-05 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Fri Dec  5 11:52:44 2014
New Revision: 218419

URL: https://gcc.gnu.org/viewcvs?rev=218419&root=gcc&view=rev
Log:
Stop only if there aren't any usable algorithms

When searching for an usable algorithm with -minline-all-stringops,
decide_alg stops when it sees libcall even if there is a usable
algorithm.  It goes into an infinite loop.  This patch changes
decide_alg to stop searching only if there aren't any usable algorithms.
Testd on Linux/x86-64.

gcc/

    Backport from mainline
    PR target/64108
    * config/i386/i386.c (decide_alg): Stop only if there aren't
    any usable algorithms.

gcc/testsuite/

    Backport from mainline
    PR target/64108
    * gcc.target/i386/memset-strategy-2.c: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.target/i386/memset-strategy-2.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/i386/i386.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug target/64108] ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops
  2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2014-12-05 11:53 ` hjl at gcc dot gnu.org
@ 2014-12-05 12:05 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2014-12-05 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for 4.9.3


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-28 21:16 [Bug target/64108] New: ICE: SIGSEGV in decide_alg() with -mmemset-strategy=libcall:-1:align -minline-all-stringops zsojka at seznam dot cz
2014-11-29 14:07 ` [Bug target/64108] " hjl.tools at gmail dot com
2014-12-02 14:11 ` hjl at gcc dot gnu.org
2014-12-04  5:13 ` zsojka at seznam dot cz
2014-12-05 11:53 ` hjl at gcc dot gnu.org
2014-12-05 12:05 ` hjl.tools 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).