public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/33138]  New: [4.3 Regression] rejects valid? assembler, segfaults
@ 2007-08-21 15:32 tbm at cyrius dot com
  2007-08-21 15:33 ` [Bug target/33138] " tbm at cyrius dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-08-21 15:32 UTC (permalink / raw)
  To: gcc-bugs

There are two issues here:
 - the inline assembly is rejected at -O.  I don't know if the assembler
   code is valid, but fwiw it's accepted by gcc 4.1 and 4.2.
 - gcc segfaults.

I see this with current trunk and with trunk from 20070720.


(sid)27576:tbm@em64t: ~] /usr/lib/gcc-snapshot/bin/gcc -c -O
samhain-sh_tiger1_64.c
samhain-sh_tiger1_64.c: In function 'tiger_compress':
samhain-sh_tiger1_64.c:12: error: can't find a register in class 'GENERAL_REGS'
while reloading 'asm'
samhain-sh_tiger1_64.c:12: error: 'asm' operand has impossible constraints
samhain-sh_tiger1_64.c: In function 'tiger_t':
samhain-sh_tiger1_64.c:23: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.
zsh: exit 1     /usr/lib/gcc-snapshot/bin/gcc -c -O samhain-sh_tiger1_64.c
(sid)27577:tbm@em64t: ~] gcc-4.1 -c -O samhain-sh_tiger1_64.c
(sid)27578:tbm@em64t: ~] gcc-4.2 -c -O samhain-sh_tiger1_64.c
(sid)27579:tbm@em64t: ~]


-- 
           Summary: [4.3 Regression] rejects valid? assembler, segfaults
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
  2007-08-21 15:33 ` [Bug target/33138] " tbm at cyrius dot com
@ 2007-08-21 15:33 ` tbm at cyrius dot com
  2007-08-28 23:57 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-08-21 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tbm at cyrius dot com  2007-08-21 15:33 -------
BTW, the segfault goes away when I remove the last 3 lines (function tiger_t).


-- 


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
@ 2007-08-21 15:33 ` tbm at cyrius dot com
  2007-08-21 15:33 ` tbm at cyrius dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-08-21 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tbm at cyrius dot com  2007-08-21 15:32 -------
typedef unsigned long int word64;
extern word64 tiger_table[4 * 256];
tiger_compress (word64 * str, word64 state[3])
{
  {
    register word64 a, b, c;
    word64 aa, bb, cc;
    word64 x0, x1, x2, x3, x4, x5, x6, x7;
    b = ((word64 *) state)[1];
    bb = b;
    cc = c;
  __asm__ ("    movl    %10, %%ebx      \n" "   movq    %11, %%rcx      \n" "  
movq    %13, %%rdx   \n" "    movq    %6, %%r8  \n" " xorq    %%r8, %2         
       \n" "  andq    %2, %%rbx  \n" "     andq     %2, %%rcx  \n" "       
andq    %2, %%rdx  \n" "        shrl    $(16-3), %%ebx  \n" "   shrq $(32-3),
%%rcx   \n" "   shrq    $(48-3), %%rdx  \n" "   movzbl  %2b, %%eax      \n" "  
movzwl  %2w, %
%edi    \n" "   movq    (%7,%%rax,8), %%rsi  \n" "      shrl    $(8), %%edi 
\n" "      movq    %2, %%
rax  \n" "      xorq    (2048*1)(%7,%%rbx), %%rsi  \n" "        movq    %2,
%%rbx  \n" "        shrl $24, %%eax \n" " andq    %12, %%rbx      \n" "   xorq 
  (2048*2)(%7,%%rcx), %%rsi  \n" "        shrq $(40-3), %%rbx \n" "     movq   
%2, %%rcx  \n" "        xorq    (2048*3)(%7,%%rdx), %%rsi  \n"
 "      movq    (2048*3)(%7,%%rdi,8), %%rdx  \n" "      shrq    $56, %%rcx \n"
"        xorq    (2048*
2)(%7,%%rax,8), %%rdx  \n" "    xorq    (2048*1)(%7,%%rbx), %%rdx  \n" "       
subq     %%rsi, %0 \n"
 "      xorq    (%7,%%rcx,8), %%rdx  \n" "      addq     %%rdx, %1 \n" "leaq   
(%1,%1,8), %1\n": "+r"
 (c), "+r" (a), "+r" (b): "r" (c), "r" (a), "r" (b), "m" (x7), "r"
(&tiger_table), "i" (0xFFL), "i" (0
xFF00L), "i" (0xFF0000L), "r" (0xFF00000000LL), "r" (0xFF0000000000LL), "r"
(0xFF000000000000LL):"3",
"%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%edi",
             "%r8");
      {
      }
    b -= bb;
    c += cc;
    ((word64 *) state)[1] = b;
    ((word64 *) state)[2] = c;
  };
}
tiger_t (word64 * str, word64 length, word64 res[3])
{
}


-- 


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
  2007-08-21 15:33 ` [Bug target/33138] " tbm at cyrius dot com
  2007-08-21 15:33 ` tbm at cyrius dot com
@ 2007-08-28 23:57 ` pinskia at gcc dot gnu dot org
  2007-09-05  2:17 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-28 23:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-08-28 23:57 -------
The seg fault was fixed by:
2007-08-28  Jakub Jelinek  <jakub@redhat.com>

        PR middle-end/32370
        * passes.c (init_optimization_passes): Move pass_df_finish
        after pass_postreload sublist.


Also I don't think there is enough registers to do anything with this
inline-asm.

I count 10 "r" constraints (or "+r").  Plus 7 clobbers.  That does not leave
any registers for GCC to fill the 10 constraints.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
                   ` (2 preceding siblings ...)
  2007-08-28 23:57 ` pinskia at gcc dot gnu dot org
@ 2007-09-05  2:17 ` mmitchel at gcc dot gnu dot org
  2007-09-05 15:42 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-09-05  2:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
                   ` (3 preceding siblings ...)
  2007-09-05  2:17 ` mmitchel at gcc dot gnu dot org
@ 2007-09-05 15:42 ` jakub at gcc dot gnu dot org
  2007-09-05 18:39 ` tbm at cyrius dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-05 15:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-09-05 15:42 -------
Yeah, the asm is bogus for multiple reasons.
But can be fixed easily, e.g. %3, %4 nor %5 aren't used anywhere, so
just nuking the unneeded
"r" (c), "r" (a), "r" (b),
makes this to compile.
Apparently e.g. gcc 4.1.x decided to give %0 the same register %3, %1 as %4
and so it happened to compile, still the constraints cause extreme register
preassure.
What is that "3" doing among clobbers?  A fancy way to duplicate "%rbx"
clobber?


-- 


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
                   ` (4 preceding siblings ...)
  2007-09-05 15:42 ` jakub at gcc dot gnu dot org
@ 2007-09-05 18:39 ` tbm at cyrius dot com
  2007-10-09 14:58 ` rguenth at gcc dot gnu dot org
  2007-10-10  7:35 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-09-05 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tbm at cyrius dot com  2007-09-05 18:38 -------
(In reply to comment #4)
> Yeah, the asm is bogus for multiple reasons.
...
> What is that "3" doing among clobbers?  A fancy way to duplicate "%rbx"
> clobber?

I don't know.  I made the testcase based on an application that I found in
Debian.  I'll forward your comments to the developer of that application to
make them aware of the problems with their code.  


-- 


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
                   ` (5 preceding siblings ...)
  2007-09-05 18:39 ` tbm at cyrius dot com
@ 2007-10-09 14:58 ` rguenth at gcc dot gnu dot org
  2007-10-10  7:35 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-10-09 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-10-09 14:58 -------
Works for me with r129166.  I suppose this was x86_64.  And a dup of either
PR33600 or PR33552.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |x86_64-*-*


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


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

* [Bug target/33138] [4.3 Regression] rejects valid? assembler, segfaults
  2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
                   ` (6 preceding siblings ...)
  2007-10-09 14:58 ` rguenth at gcc dot gnu dot org
@ 2007-10-10  7:35 ` tbm at cyrius dot com
  7 siblings, 0 replies; 9+ messages in thread
From: tbm at cyrius dot com @ 2007-10-10  7:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tbm at cyrius dot com  2007-10-10 07:35 -------
(In reply to comment #6)
> Works for me with r129166.  I suppose this was x86_64.  And a dup of either
> PR33600 or PR33552.

Yeah, it was a dup.


*** This bug has been marked as a duplicate of 32370 ***


-- 

tbm at cyrius dot com changed:

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


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


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

end of thread, other threads:[~2007-10-10  7:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 15:32 [Bug target/33138] New: [4.3 Regression] rejects valid? assembler, segfaults tbm at cyrius dot com
2007-08-21 15:33 ` [Bug target/33138] " tbm at cyrius dot com
2007-08-21 15:33 ` tbm at cyrius dot com
2007-08-28 23:57 ` pinskia at gcc dot gnu dot org
2007-09-05  2:17 ` mmitchel at gcc dot gnu dot org
2007-09-05 15:42 ` jakub at gcc dot gnu dot org
2007-09-05 18:39 ` tbm at cyrius dot com
2007-10-09 14:58 ` rguenth at gcc dot gnu dot org
2007-10-10  7:35 ` tbm at cyrius 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).