<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [PowerPC] codegen problem in loop, results in run-time SIGSEGV in application"
   href="https://bugs.llvm.org/show_bug.cgi?id=32291">32291</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PowerPC] codegen problem in loop, results in run-time SIGSEGV in application
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eric.schweitz@pgroup.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18103" name="attach_18103" title="reduced test case">attachment 18103</a> <a href="attachment.cgi?id=18103&action=edit" title="reduced test case">[details]</a></span>
reduced test case

In the (bugpoint reduced) test case, I've marked a basic block with the label
"L.bug_here", which is where I found the SIGSEGV was happening in the original
program.

Here is the LLVM IR:
L.bug_here:                                  ; preds = %L.bug_here,
%L.LB2_5666.prol.preheader
  %z00go = phi i64 [ 0, %L.LB2_5666.prol.preheader ], [ %696, %L.bug_here ]
  %z00gp = phi i64 [ %z00fr, %L.LB2_5666.prol.preheader ], [ %z00gq,
%L.bug_here ]
  %695 = load i8*, i8** %445, align 8, !dbg !1187, !tbaa !1157
  %696 = add nuw nsw i64 %z00go, 1, !dbg !1187
  %697 = mul i64 %z00gn, %696, !dbg !1187
  %698 = add i64 %694, %697, !dbg !1187
  %699 = mul i64 %698, %z00gl, !dbg !1187
  %700 = getelementptr i8, i8* %695, i64 %699, !dbg !1187
  %701 = bitcast i8* %700 to i64*, !dbg !1187
  %702 = load i64, i64* %701, align 8, !dbg !1187, !tbaa !1157
  %z00gr = shl i64 %z00go, 32, !dbg !1187
  %703 = ashr exact i64 %z00gr, 32, !dbg !1187
  %704 = getelementptr double, double* %693, i64 %703, !dbg !1187
  %705 = bitcast double* %704 to i64*, !dbg !1187
  store i64 %702, i64* %705, align 8, !dbg !1187, !tbaa !1240
  %z00gq = add i64 %z00gp, -1, !dbg !1187
  %z00gs = icmp eq i64 %z00gq, 0, !dbg !1187
  br i1 %z00gs, label %L.LB2_5666.prol.loopexit.unr-lcssa, label %L.bug_here,
!dbg !1187, !llvm.loop !1242

Using llc v3.9, this basic block does NOT suffer a SIGSEGV and appears as:

.LBB1_83:                               # %L.bug_here
                                        #   Parent Loop BB1_26 Depth=1
                                        #     Parent Loop BB1_42 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
        .loc    1 107 1                 # z000002b9:107:1
        ld 11, 0(20)
        sldi 0, 28, 32
        sradi 12, 10, 29
        addi 7, 7, 1
        add 10, 10, 0
        ldx 11, 11, 8
        add 8, 8, 9
        stdx 11, 3, 12
        bdnz .LBB1_83

Using llc v4.0, this basic block appears as:

.LBB1_88:                               # %L.bug_here
                                        #   Parent Loop BB1_29 Depth=1
                                        #     Parent Loop BB1_47 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
        .loc    1 107 1 is_stmt 1       # z000002b9:107:1
        ld 11, 0(25)
        addi 7, 7, 1
        ldx 11, 11, 9
        add 9, 9, 10
        stdu 11, 8(8)
        bdnz .LBB1_88

In this latter asm, r8 is loaded with an unmapped memory address and the
program takes a signal on the stdu insn.

The command used to compile the .ll file was simply:

% llc -o simplified.s simplified.ll

PS: It appears that the master branch generates a code pattern much like v3.9.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>