public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
@ 2010-10-15  0:47 zsojka at seznam dot cz
  2010-10-15  0:53 ` [Bug tree-optimization/46029] " zsojka at seznam dot cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2010-10-15  0:47 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: -ftree-loop-if-convert-stores causes FAIL:
                    libstdc++-v3/testsuite/ext/pb_ds/example/tree_interval
                    s.cc
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 22047
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22047
preprocessed source

Output:
$ g++ -O -fstrict-aliasing -ftree-loop-if-convert-stores -std=c++0x
tree_intervalsn64.C
$ valgrind ./a.out
==26534== Invalid read of size 4
==26534==    at 0x40550D: void
some_op_sequence<__gnu_pbds::tree<std::pair<unsigned int, unsigned int>,
__gnu_pbds::null_mapped_type, std::less<std::pair<unsigned int, unsigned int>
>, __gnu_pbds::rb_tree_tag, intervals_node_update, std::allocator<char> >
>(__gnu_pbds::tree<std::pair<unsigned int, unsigned int>,
__gnu_pbds::null_mapped_type, std::less<std::pair<unsigned int, unsigned int>
>, __gnu_pbds::rb_tree_tag, intervals_node_update, std::allocator<char> >) (in
/home/smatz/gcc-bug/434/a.out)
==26534==    by 0x400A70: main (in /home/smatz/gcc-bug/434/a.out)
==26534==  Address 0x24 is not stack'd, malloc'd or (recently) free'd
==26534== 
==26534== 
==26534== Process terminating with default action of signal 11 (SIGSEGV)
==26534==  Access not within mapped region at address 0x24
==26534==    at 0x40550D: void
some_op_sequence<__gnu_pbds::tree<std::pair<unsigned int, unsigned int>,
__gnu_pbds::null_mapped_type, std::less<std::pair<unsigned int, unsigned int>
>, __gnu_pbds::rb_tree_tag, intervals_node_update, std::allocator<char> >
>(__gnu_pbds::tree<std::pair<unsigned int, unsigned int>,
__gnu_pbds::null_mapped_type, std::less<std::pair<unsigned int, unsigned int>
>, __gnu_pbds::rb_tree_tag, intervals_node_update, std::allocator<char> >) (in
/home/smatz/gcc-bug/434/a.out)
==26534==    by 0x400A70: main (in /home/smatz/gcc-bug/434/a.out)


Tested revisions:
r165354 - fail
r163636 - fail
r161659 - doen't know -ftree-loop-if-convert-stores


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
@ 2010-10-15  0:53 ` zsojka at seznam dot cz
  2010-10-15  9:52 ` zsojka at seznam dot cz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2010-10-15  0:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2010-10-15 00:53:15 UTC ---
Created attachment 22048
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22048
hopefully reduced testcase

$ g++ -O -ftree-loop-if-convert-stores pr46029.C
$ ./a.out 
Segmentation fault

In the assembly, with -ftree-loop-if-convert-stores, "nd_it.get_l_child
().get_metadata ()" in apply_update() is loaded unconditionally.

62a64
>       mov     esi, 0  # tmp69,
64,69c66,70
<       mov     rcx, QWORD PTR [rax]    # D.2294, p_nd_32->m_p_left
<       mov     edx, 0  # l_max_endpoint,
<       test    rcx, rcx        # D.2294
<       je      .L3     #,
<       mov     edx, DWORD PTR [rcx+16] # l_max_endpoint, MEM[(unsigned int
&)D.2294_12 + 16]
< .L3:
---
>       mov     rdx, QWORD PTR [rax]    # D.2294, p_nd_32->m_p_left
>       mov     ecx, DWORD PTR [rdx+16] # l_max_endpoint, MEM[(unsigned int &)D.2294_12 + 16]
>       test    rdx, rdx        # D.2294
>       mov     edx, esi        # l_max_endpoint, tmp69
>       cmovne  edx, ecx        # l_max_endpoint,, l_max_endpoint

In the first case, memory is not accessed if the pointer is NULL, but in the
second, "mov ecx, DWORD PTR [rdx+16]" reads invalid memory.


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
  2010-10-15  0:53 ` [Bug tree-optimization/46029] " zsojka at seznam dot cz
@ 2010-10-15  9:52 ` zsojka at seznam dot cz
  2010-12-23 17:21 ` spop at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2010-10-15  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22048|0                           |1
        is obsolete|                            |

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> 2010-10-15 09:52:00 UTC ---
Created attachment 22049
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22049
more reduced testcase

Interestingly, when the code is moved out of the explicit anonymous namespace,
it works.
The difference is asm is same as in previous testcase. This one should be just
more readable.


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
  2010-10-15  0:53 ` [Bug tree-optimization/46029] " zsojka at seznam dot cz
  2010-10-15  9:52 ` zsojka at seznam dot cz
@ 2010-12-23 17:21 ` spop at gcc dot gnu.org
  2015-05-05 11:17 ` alalaw01 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: spop at gcc dot gnu.org @ 2010-12-23 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

Sebastian Pop <spop at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.12.23 17:20:47
         AssignedTo|unassigned at gcc dot       |spop at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Sebastian Pop <spop at gcc dot gnu.org> 2010-12-23 17:20:47 UTC ---
This bug is fixed by the rewrite of the if-convert-stores patch:
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00304.html


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-12-23 17:21 ` spop at gcc dot gnu.org
@ 2015-05-05 11:17 ` alalaw01 at gcc dot gnu.org
  2015-05-06 22:07 ` spop at gcc dot gnu.org
  2021-10-11  1:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: alalaw01 at gcc dot gnu.org @ 2015-05-05 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

alalaw01 at gcc dot gnu.org changed:

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

--- Comment #4 from alalaw01 at gcc dot gnu.org ---
I'm still seeing this problem with -ftree-loop-if-convert-stores, introducing
faults by converting conditional to unconditional loads. It doesn't look as if
Sebastian Pop's patches went in (after being approved,
https://gcc.gnu.org/ml/gcc-patches/2010-11/msg01670.html). Can anyone shed any
light on this?


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2015-05-05 11:17 ` alalaw01 at gcc dot gnu.org
@ 2015-05-06 22:07 ` spop at gcc dot gnu.org
  2021-10-11  1:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: spop at gcc dot gnu.org @ 2015-05-06 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Sebastian Pop <spop at gcc dot gnu.org> ---
Maybe the patch was not committed because it was not ready before stage3:
"GCC 4.6 Stage 3 (starts 2010-11-03)".  I will update the patch and resubmit
for review.


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

* [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
  2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2015-05-06 22:07 ` spop at gcc dot gnu.org
@ 2021-10-11  1:33 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-11  1:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
r7-4646 removed -ftree-loop-if-convert-stores option support.

Note it might have been fixed with r6-5362.

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

end of thread, other threads:[~2021-10-11  1:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-15  0:47 [Bug tree-optimization/46029] New: -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc zsojka at seznam dot cz
2010-10-15  0:53 ` [Bug tree-optimization/46029] " zsojka at seznam dot cz
2010-10-15  9:52 ` zsojka at seznam dot cz
2010-12-23 17:21 ` spop at gcc dot gnu.org
2015-05-05 11:17 ` alalaw01 at gcc dot gnu.org
2015-05-06 22:07 ` spop at gcc dot gnu.org
2021-10-11  1:33 ` pinskia 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).