public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/16537] New: ICE Compiling Linux Kernel
@ 2004-07-14 13:52 krebbel1 at de dot ibm dot com
  2004-07-14 13:56 ` [Bug middle-end/16537] " reichelt at gcc dot gnu dot org
  2004-07-14 15:18 ` [Bug middle-end/16537] [3.5 regression] " pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: krebbel1 at de dot ibm dot com @ 2004-07-14 13:52 UTC (permalink / raw)
  To: gcc-bugs

I've trouble compiling the linux 2.6 kernel on s390 with the current cvs 
head gcc but I could reproduce the problem on Intel too. 

The compile produced an ICE in 
arch/s390/kernel/time.c:account_ticks.

I've reduced the testcase to:

void account_ticks(void)
{
 unsigned long tmp;
 unsigned short ticks;

 tmp = 0;

 ticks = tmp;

 asm volatile ("SCKC %0" : : "m" (tmp));

}

Compiled on 32 bit Intel with:

gcc test.i

results in the following ICE:

test.i: In function `account_ticks':
test.i:3: error: Invalid operand to unary operator
tmp<D1120>

test.i:3: internal compiler error: verify_stmts failed.

gcc -v says:

Reading specs from /usr/local/gcc-3.5/lib/gcc/i486-linux/3.5.0/specs
Configured with: ../gcc-3.5/configure -v --enable-languages=c,c++
--prefix=/usr/local/gcc-3.5 --enable-shared --with-system-zlib --enable-nls
--without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu
--enable-debug i486-linux
Thread model: posix
gcc version 3.5.0 20040714 (experimental)

The ICE doesn't occur with gcc from 06/28/2004!

The line with ticks=tmp; seems to be dead code but is essential for the
occurrence of the ICE as well as the implicit type cast from long to short.

Breakpoint 19, error (msgid=0x0) at ../../gcc-3.5/gcc/diagnostic.c:497
497       va_start (ap, msgid);
(gdb) bt
#0  error (msgid=0x0) at ../../gcc-3.5/gcc/diagnostic.c:497
#1  0x080baa07 in verify_expr (tp=0x6f, walk_subtrees=0xbfffecc4, data=0x0)
    at ../../gcc-3.5/gcc/tree-cfg.c:3201
#2  0x083d5d6e in walk_tree (tp=0x4016a1f4, func=0x80ba640 <verify_expr>,
data=0x0, htab_=0x0)
    at ../../gcc-3.5/gcc/tree-inline.c:2033
#3  0x080bb1e0 in verify_stmt (stmt=0x4016a1d4, last_in_block=0 '\0')
    at ../../gcc-3.5/gcc/tree-cfg.c:3310
#4  0x080bb6b8 in verify_stmts () at tree-flow-inline.h:600
#5  0x080cb81a in execute_one_pass (pass=0x850f100) at
../../gcc-3.5/gcc/tree-optimize.c:416
#6  0x080cb918 in execute_pass_list (pass=0x850f100) at
../../gcc-3.5/gcc/tree-optimize.c:435
#7  0x080cba65 in tree_rest_of_compilation (fndecl=0x4021b5e4, nested_p=0 '\0')

In verify_expr is_gimple_val returns false for the tmp var_decl due to the
following check:
(tree-gimple.c:404)

if (is_gimple_variable (t)
      && is_gimple_reg_type (TREE_TYPE (t))
      && !is_gimple_reg (t))
    return false;

Wherein is_gimple_reg returns false because the addressable_flag of tmp
is set which should be issued by the "m" constraint in the inline assembly.

As far as I've understood, the "m" constraint forces tmp to be placed in memory
but for the type conversion verify_expr refuses to use a temporary memory slot?

-- 
           Summary: ICE Compiling Linux Kernel
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: dnovillo at redhat dot com
        ReportedBy: krebbel1 at de dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


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


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

* [Bug middle-end/16537] ICE Compiling Linux Kernel
  2004-07-14 13:52 [Bug middle-end/16537] New: ICE Compiling Linux Kernel krebbel1 at de dot ibm dot com
@ 2004-07-14 13:56 ` reichelt at gcc dot gnu dot org
  2004-07-14 15:18 ` [Bug middle-end/16537] [3.5 regression] " pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-07-14 13:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-07-14 13:56 -------
Confirmed.

Even shorter example:

==============================
void foo(int i)
{
    short j=i;
    __asm__ ("" :: "m"(i));
}
==============================


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code, monitored
      Known to fail|                            |3.5.0
      Known to work|                            |3.3.4 3.4.1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-14 13:56:32
               date|                            |
   Target Milestone|---                         |3.5.0


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


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

* [Bug middle-end/16537] [3.5 regression] ICE Compiling Linux Kernel
  2004-07-14 13:52 [Bug middle-end/16537] New: ICE Compiling Linux Kernel krebbel1 at de dot ibm dot com
  2004-07-14 13:56 ` [Bug middle-end/16537] " reichelt at gcc dot gnu dot org
@ 2004-07-14 15:18 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-14 15:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-14 15:18 -------
The problem is more complex than people think, see PR 15740 which this is a dup where I had thought 
through a fix but I decided it would not work.

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

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


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


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

end of thread, other threads:[~2004-07-14 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-14 13:52 [Bug middle-end/16537] New: ICE Compiling Linux Kernel krebbel1 at de dot ibm dot com
2004-07-14 13:56 ` [Bug middle-end/16537] " reichelt at gcc dot gnu dot org
2004-07-14 15:18 ` [Bug middle-end/16537] [3.5 regression] " pinskia at gcc dot gnu dot 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).