public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/53045] New: Missing loop termination
@ 2012-04-19 17:00 ubizjak at gmail dot com
  2012-04-20  9:23 ` [Bug tree-optimization/53045] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2012-04-19 17:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53045

             Bug #: 53045
           Summary: Missing loop termination
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ubizjak@gmail.com


Following testcase

--cut here--
struct { double d[1]; } foo0, foo1, foo2, foo3, foo4, foo5, foo6, foo7;

int main ()
{
  struct { double d; } bar[8]
    = { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 };
  int i;

  for (i = 0; i < 8; i++)
    foo0.d[i] = bar[i].d;

  return 0;
}
-- cut here--

segfaults when compiled with -O2,
xgcc (GCC) 4.8.0 20120419 (experimental) [trunk revision 186596]

Loop termination is missing from asm dump:

.L2:
        movsd   %xmm0, foo0(%rax)
        movsd   -64(%rsp,%rax), %xmm0
        addq    $8, %rax
        jmp     .L2

Loop termination is already missing from .optimized dump:

This problem is the reason for following testsuite failures on x86 AVX:

FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -O2 
FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -O3
-fomit-frame-pointer 
FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -O3
-fomit-frame-pointer -funroll-loops 
FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -O3
-fomit-frame-pointer -funroll-all-loops -finli
ne-functions 
FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -O3 -g 
FAIL: gcc.target/x86_64/abi/avx/test_passing_structs.c execution,  -Os 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -O2 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -O3
-fomit-frame-pointer 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -O3
-fomit-frame-pointer -funroll-loops 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -O3
-fomit-frame-pointer -funroll-all-loops -finlin
e-functions 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -O3 -g 
FAIL: gcc.target/x86_64/abi/avx/test_passing_unions.c execution,  -Os


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

* [Bug tree-optimization/53045] Missing loop termination
  2012-04-19 17:00 [Bug tree-optimization/53045] New: Missing loop termination ubizjak at gmail dot com
@ 2012-04-20  9:23 ` rguenth at gcc dot gnu.org
  2012-04-20  9:24 ` rguenth at gcc dot gnu.org
  2012-04-20 16:14 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-20  9:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53045

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

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

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-20 09:23:09 UTC ---
struct { double d[1]; } foo0, foo1, foo2, foo3, foo4, foo5, foo6, foo7;

int main ()
{
  struct { double d; } bar[8]
    = { 48.394, 39.3, -397.9, 3484.9, -8.394, -93.3, 7.9, 84.94 };
  int i;

  for (i = 0; i < 8; i++)
    foo0.d[i] = bar[i].d;

  return 0;
}

This is invalid source - foo0.d[1] is an out-of-bound access.  Number of
iteration analysis correctly concludes that i is in the range of [0, 0]
and optimizes away the loop exit test.


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

* [Bug tree-optimization/53045] Missing loop termination
  2012-04-19 17:00 [Bug tree-optimization/53045] New: Missing loop termination ubizjak at gmail dot com
  2012-04-20  9:23 ` [Bug tree-optimization/53045] " rguenth at gcc dot gnu.org
@ 2012-04-20  9:24 ` rguenth at gcc dot gnu.org
  2012-04-20 16:14 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-20  9:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53045

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-20 09:24:06 UTC ---
Btw, see how I fixed

2012-04-18  Richard Guenther  <rguenther@suse.de>

        * gcc.target/x86_64/abi/test_passing_unions.c: Avoid undefined
        array access.
        * gcc.target/x86_64/abi/test_passing_structs.c: Likewise.
        * gcc.target/i386/avx256-unaligned-load-4.c: Fix array sizes.

I suppose I didn't see the AVX fails because my testing box doesn't have AVX.


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

* [Bug tree-optimization/53045] Missing loop termination
  2012-04-19 17:00 [Bug tree-optimization/53045] New: Missing loop termination ubizjak at gmail dot com
  2012-04-20  9:23 ` [Bug tree-optimization/53045] " rguenth at gcc dot gnu.org
  2012-04-20  9:24 ` rguenth at gcc dot gnu.org
@ 2012-04-20 16:14 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2012-04-20 16:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53045

--- Comment #3 from Uros Bizjak <ubizjak at gmail dot com> 2012-04-20 16:13:49 UTC ---
(In reply to comment #2)
> Btw, see how I fixed
> 
> 2012-04-18  Richard Guenther  <rguenther@suse.de>
> 
>         * gcc.target/x86_64/abi/test_passing_unions.c: Avoid undefined
>         array access.
>         * gcc.target/x86_64/abi/test_passing_structs.c: Likewise.
>         * gcc.target/i386/avx256-unaligned-load-4.c: Fix array sizes.
> 
> I suppose I didn't see the AVX fails because my testing box doesn't have AVX.

Thanks, I have fixed AVX testcases in the same way.


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

end of thread, other threads:[~2012-04-20 16:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 17:00 [Bug tree-optimization/53045] New: Missing loop termination ubizjak at gmail dot com
2012-04-20  9:23 ` [Bug tree-optimization/53045] " rguenth at gcc dot gnu.org
2012-04-20  9:24 ` rguenth at gcc dot gnu.org
2012-04-20 16:14 ` ubizjak 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).