public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/49721] convert_memory_address_addr_space may generate invalid new insns
Date: Thu, 18 Aug 2011 22:43:00 -0000	[thread overview]
Message-ID: <bug-49721-4-BmhuMJaG85@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49721-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #25 from H.J. Lu <hjl.tools at gmail dot com> 2011-08-18 21:56:43 UTC ---
Another testcase:

[hjl@gnu-6 pr49721]$ cat foo.f
      PARAMETER( LM=7 )
     PARAMETER( NM=2+2**LM, NV=NM**3 )
     PARAMETER( NR = (8*(NM**3+NM**2+5*NM-23+7*LM))/7 )
       COMMON /X/ U, V, R, A
     REAL*8 U(NR),V(NV),R(NR),A(0:3)
     DO 20 IT=1,NIT
       CALL RESID(U,V,R,N,A)
 20   CONTINUE
     END
[hjl@gnu-6 pr49721]$

"-mx32 -O2 -ffast-math" may pass:

(plus:SI (symbol_ref:SI ("x_") <var_decl 0x7ffff188b1e0 x>)
   (const_int 58071104 [0x3761840]))

to

convert_memory_address_addr_space 

#2  0x000000000078c0d1 in convert_memory_address_addr_space (to_mode=DImode,
   x=0x7ffff1971a10, as=0 '\000')
   at /export/gnu/import/git/gcc-x32/gcc/explow.c:380
#3  0x0000000000b06f58 in simplify_unary_operation_1 (code=ZERO_EXTEND,
   mode=DImode, op=0x7ffff1971a10)
   at /export/gnu/import/git/gcc-x32/gcc/simplify-rtx.c:1246
#4  0x0000000000b04cb1 in simplify_unary_operation (code=ZERO_EXTEND,
   mode=DImode, op=0x7ffff1971a10, op_mode=SImode)
   at /export/gnu/import/git/gcc-x32/gcc/simplify-rtx.c:582
#5  0x000000000118b977 in fold_rtx (x=0x7ffff1971a20, insn=0x7ffff1886ee8)
   at /export/gnu/import/git/gcc-x32/gcc/cse.c:3353
#6  0x000000000118e51f in cse_insn (insn=0x7ffff1886ee8)
   at /export/gnu/import/git/gcc-x32/gcc/cse.c:4500
#7  0x000000000119387e in cse_extended_basic_block (ebb_data=0x7fffffffdad0)
   at /export/gnu/import/git/gcc-x32/gcc/cse.c:6345
#8  0x0000000001193e5f in cse_main (f=0x7ffff1881b40, nregs=80)
   at /export/gnu/import/git/gcc-x32/gcc/cse.c:6522
#9  0x0000000001195999 in rest_of_handle_cse ()

If we don't permute, we will get

Program received signal SIGSEGV, Segmentation fault.
0x0000000000622263 in init_alias_analysis ()
   at /export/gnu/import/git/gcc-x32/gcc/alias.c:2870
2870                      else if (DF_REG_DEF_COUNT (regno) == 1
(gdb) bt
#0  0x0000000000622263 in init_alias_analysis ()
   at /export/gnu/import/git/gcc-x32/gcc/alias.c:2870
#1  0x00000000008d07bc in one_pre_gcse_pass ()
   at /export/gnu/import/git/gcc-x32/gcc/gcse.c:2650
#2  0x00000000008d2aa5 in execute_rtl_pre ()
   at /export/gnu/import/git/gcc-x32/gcc/gcse.c:3727
#3  0x0000000000a47514 in execute_one_pass (pass=0x191ea60)
   at /export/gnu/import/git/gcc-x32/gcc/passes.c:2063
#4  0x0000000000a476fa in execute_pass_list (pass=0x191ea60)
   at /export/gnu/import/git/gcc-x32/gcc/passes.c:2118
#5  0x0000000000a4771b in execute_pass_list (pass=0x191f4a0)
   at /export/gnu/import/git/gcc-x32/gcc/passes.c:2119
#6  0x0000000000be1331 in tree_rest_of_compilation (fndecl=0x7ffff197b700)
   at /export/gnu/import/git/gcc-x32/gcc/tree-optimize.c:420
#7  0x00000000006d69ce in cgraph_expand_function (node=0x7ffff1888a20)
   at /export/gnu/import/git/gcc-x32/gcc/cgraphunit.c:1797
#8  0x00000000006d6b8d in cgraph_expand_all_functions ()
   at /export/gnu/import/git/gcc-x32/gcc/cgraphunit.c:1856
#9  0x00000000006d7289 in cgraph_optimize ()
   at /export/gnu/import/git/gcc-x32/gcc/cgraphunit.c:2126
#10 0x00000000006d4755 in cgraph_finalize_compilation_unit ()
   at /export/gnu/import/git/gcc-x32/gcc/cgraphunit.c:1310
#11 0x00000000009d2e84 in write_global_declarations ()
...


  parent reply	other threads:[~2011-08-18 21:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 19:14 [Bug middle-end/49721] New: " hjl.tools at gmail dot com
2011-07-28 21:11 ` [Bug middle-end/49721] " hjl.tools at gmail dot com
2011-07-28 21:28 ` hjl.tools at gmail dot com
2011-07-28 21:31 ` pinskia at gcc dot gnu.org
2011-07-28 21:40 ` hjl.tools at gmail dot com
2011-08-02 14:17 ` hjl.tools at gmail dot com
2011-08-02 15:40 ` ubizjak at gmail dot com
2011-08-02 15:57 ` hjl.tools at gmail dot com
2011-08-02 15:59 ` hjl.tools at gmail dot com
2011-08-02 18:36 ` ubizjak at gmail dot com
2011-08-02 19:18 ` hjl.tools at gmail dot com
2011-08-02 19:19 ` ubizjak at gmail dot com
2011-08-02 19:29 ` hjl.tools at gmail dot com
2011-08-02 19:33 ` ubizjak at gmail dot com
2011-08-02 19:42 ` hjl.tools at gmail dot com
2011-08-02 20:22 ` ubizjak at gmail dot com
2011-08-03  2:40 ` hjl.tools at gmail dot com
2011-08-03  6:33 ` bonzini at gnu dot org
2011-08-03  6:41 ` ubizjak at gmail dot com
2011-08-03  6:48 ` ubizjak at gmail dot com
2011-08-03 13:57 ` hjl.tools at gmail dot com
2011-08-03 14:07 ` ubizjak at gmail dot com
2011-08-03 14:49 ` hjl.tools at gmail dot com
2011-08-09 13:23 ` hjl at gcc dot gnu.org
2011-08-09 13:24 ` hjl at gcc dot gnu.org
2011-08-18 22:43 ` hjl.tools at gmail dot com [this message]
2011-08-19 21:20 ` hjl at gcc dot gnu.org
2014-05-29  4:35 ` pinskia at gcc dot gnu.org
2014-05-29 16:01 ` hjl.tools at gmail dot com
2014-05-30  2:17 ` pinskia at gcc dot gnu.org
2014-05-30 20:51 ` pinskia at gcc dot gnu.org
2014-05-30 21:29 ` hjl.tools at gmail dot com
2014-05-30 22:47 ` pinskia at gcc dot gnu.org
2014-05-30 22:52 ` pinskia at gcc dot gnu.org
2014-10-15  0:38 ` pinskia at gcc dot gnu.org
2014-11-13 14:01 ` yroux at gcc dot gnu.org
2014-11-23  4:13 ` 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=bug-49721-4-BmhuMJaG85@http.gcc.gnu.org/bugzilla/ \
    --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).