public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand
@ 2003-09-12  7:32 falk at debian dot org
  2003-09-17  5:00 ` [Bug optimization/12260] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-09-12  7:32 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: ICE in output_operand: invalid expression as operand
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu

falk@juist:/tmp% cat test.i          
static char buf[512];
void h(int l) {
    while (l) {
        char *op = buf;
        if (f() == 0)
            break;
        if (g(op - buf + 1))
            break;
    }
}

falk@juist:/tmp% gcc -v -c -O2 test.i
Reading specs from
/usr/local/stow/gcc-2003.09.11/bin/../lib/gcc/alphaev68-unknown-linux-gnu/3.4/specs
Configured with: '../configure' '--disable-nls '--enable-languages=c++
Thread model: posix
gcc version 3.4 20030911 (experimental)
 /usr/local/stow/gcc-2003.09.11/bin/../libexec/gcc/alphaev68-unknown-linux-gnu/3.4/cc1 -fpreprocessed test.i -quiet -dumpbase test.i -mcpu=ev67 -auxbase test -O2 -version -o /tmp/ccKcZH4C.s
GNU C version 3.4 20030911 (experimental) (alphaev68-unknown-linux-gnu)
        compiled by GNU C version 3.4 20030911 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
test.i: In function `h':

test.i:10: internal compiler error: output_operand: invalid expression as operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Does not occur with -O1. Also works with gcc 3.4 20030819.


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

* [Bug optimization/12260] [3.4 Regression] ICE in output_operand: invalid expression as operand
  2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
@ 2003-09-17  5:00 ` pinskia at gcc dot gnu dot org
  2003-09-23 21:28 ` falk at debian dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-17  5:00 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
            Summary|ICE in output_operand:      |[3.4 Regression] ICE in
                   |invalid expression as       |output_operand: invalid
                   |operand                     |expression as operand
   Target Milestone|---                         |3.4


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

* [Bug optimization/12260] [3.4 Regression] ICE in output_operand: invalid expression as operand
  2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
  2003-09-17  5:00 ` [Bug optimization/12260] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2003-09-23 21:28 ` falk at debian dot org
  2003-10-01  6:41 ` falk at debian dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-09-23 21:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


falk at debian dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1


------- Additional Comments From falk at debian dot org  2003-09-23 21:11 -------
The problem is caused by output_operand getting passed this rtx:

(neg:DI (const:DI (plus:DI (symbol_ref:DI ("buf")
					  [flags 0x2]
					  <var_decl 0x200002a6680 buf>)
			   (const_int -1 [0xffffffffffffffff]))))

which it doesn't know how to handle. It originates from gcse, which adds to this
insn:

(insn 34 33 35 2
      (set (reg:DI 79)
	   (minus:DI (reg:DI 80)
		     (reg/v/f:DI 72 [ op ]))) 28 {subdi3} (nil)
		     (nil))

this note:

(neg:DI (const:DI (plus:DI (symbol_ref:DI ("buf")
					  [flags 0x2]
					  <var_decl 0x200002a6680 buf>)
			   (const_int -1 [0xffffffffffffffff]))))

It seems that gcc decided (op - buf) + 1 would be better calculated as 
op + (-buf - 1). Phil's regression hunter says:

Search converges between 2003-09-11-trunk (#398) and 2003-09-12-trunk (#399).

I suspect this patch exposed the problem:
2003-09-10  Roger Sayle  <roger@eyesopen.com>

	* combine.c (combine_simplify_rtx): Move several NOT and NEG
	optimizations from here...
	* simplify-rtx.c (simplify_unary_operation): to here.  Recursively
	simplify expressions using simplify_gen_*ary instead of gen_rtx_*.

The transformation seems valid, so I guess a simple solution would be to
have output_operand handle (neg x) just like (0 - x). I don't know whether
all assemblers would like that, though...


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

* [Bug optimization/12260] [3.4 Regression] ICE in output_operand: invalid expression as operand
  2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
  2003-09-17  5:00 ` [Bug optimization/12260] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2003-09-23 21:28 ` falk at debian dot org
@ 2003-10-01  6:41 ` falk at debian dot org
  2003-10-11 21:06 ` cvs-commit at gcc dot gnu dot org
  2003-10-11 22:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2003-10-01  6:41 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From falk at debian dot org  2003-10-01 06:41 -------
A patch was posted by Roger Sayle:
http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01664.html


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

* [Bug optimization/12260] [3.4 Regression] ICE in output_operand: invalid expression as operand
  2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
                   ` (2 preceding siblings ...)
  2003-10-01  6:41 ` falk at debian dot org
@ 2003-10-11 21:06 ` cvs-commit at gcc dot gnu dot org
  2003-10-11 22:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-10-11 21:06 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-10-11 21:06 -------
Subject: Bug 12260

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2003-10-11 21:06:19

Modified files:
	gcc            : ChangeLog simplify-rtx.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/compile: 20031011-2.c 

Log message:
	PR optimization/12260
	* simplify-rtx.c (simplify_unary_operation): Simplify all unary
	operations through CONST nodes.  Optimize (neg (plus X C)) as
	(minus -C X) for constant values C.
	(simplify_binary_operation): Optimize (minus (neg X) C) as
	(minus -C X) for constant values C.
	(simplify_plus_minus): Avoid creating (neg (const (plus X C)),
	instead create (minus -C X).
	
	* gcc.c-torture/compile/20031011-2.c: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1385&r2=2.1386
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/simplify-rtx.c.diff?cvsroot=gcc&r1=1.162&r2=1.163
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3113&r2=1.3114
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20031011-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug optimization/12260] [3.4 Regression] ICE in output_operand: invalid expression as operand
  2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
                   ` (3 preceding siblings ...)
  2003-10-11 21:06 ` cvs-commit at gcc dot gnu dot org
@ 2003-10-11 22:12 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-11 22:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

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


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-11 22:12 -------
Fixed.


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

end of thread, other threads:[~2003-10-11 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-12  7:32 [Bug optimization/12260] New: ICE in output_operand: invalid expression as operand falk at debian dot org
2003-09-17  5:00 ` [Bug optimization/12260] [3.4 Regression] " pinskia at gcc dot gnu dot org
2003-09-23 21:28 ` falk at debian dot org
2003-10-01  6:41 ` falk at debian dot org
2003-10-11 21:06 ` cvs-commit at gcc dot gnu dot org
2003-10-11 22:12 ` 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).