public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/46029] -ftree-loop-if-convert-stores causes FAIL: libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc
Date: Fri, 15 Oct 2010 00:53:00 -0000	[thread overview]
Message-ID: <20101015005300.ev3i-RrO2idlxTptM5YbyXPIChctxpV3Kiriy6DUBzU@z> (raw)
In-Reply-To: <bug-46029-4@http.gcc.gnu.org/bugzilla/>

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.


  reply	other threads:[~2010-10-15  0:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-15  0:47 [Bug tree-optimization/46029] New: " zsojka at seznam dot cz
2010-10-15  0:53 ` zsojka at seznam dot cz [this message]
2010-10-15  9:52 ` [Bug tree-optimization/46029] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101015005300.ev3i-RrO2idlxTptM5YbyXPIChctxpV3Kiriy6DUBzU@z \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).