public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/21897] New: Segementation fault in fold_ternary
@ 2005-06-03  9:13 e9925248 at stud4 dot tuwien dot ac dot at
  2005-06-03 13:59 ` [Bug middle-end/21897] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: e9925248 at stud4 dot tuwien dot ac dot at @ 2005-06-03  9:13 UTC (permalink / raw)
  To: gcc-bugs

Example code:
#define vector64 __attribute__((vector_size(8)))

main(){

 vector64 short  c;
vector64 short a = {1, -1};
vector64 short b = {2, -2};
c = -a + b*b*(-1LL);

 printf("result is %llx\n", (long long)c);
}

If it is compiled with -O3 a Segmentation fault happens.
GNU C version 4.1.0 20050603 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.0 20050302 (experimental).
GGC heuristics: --param ggc-min-expand=0 --param ggc-min-heapsize=0

gcc (GCC) 4.1.0 20050302 (experimental)
and later (at least till 20050501) can compile this file with -O3.

The fold of this expression causes the segmentation fault:
 <bit_field_ref 0xb7f56118
    type <integer_type 0xb7ef6438 short int public HI
        size <integer_cst 0xb7eee318 constant invariant 16>
        unit size <integer_cst 0xb7eee330 constant invariant 2>
        align 16 symtab 0 alias set -1 precision 16 min <integer_cst 0xb7eee2b8
-32768> max <integer_cst 0xb7eee2e8 32767>
        pointer_to_this <pointer_type 0xb7f069b4>>

    arg 0 <vector_cst 0xb7f1d018
        type <vector_type 0xb7f06b64 type <integer_type 0xb7ef6438 short int>
            sizes-gimplified DI
            size <integer_cst 0xb7eee540 constant invariant 64>
            unit size <integer_cst 0xb7eee558 constant invariant 8>
            align 64 symtab 0 alias set -1 nunits 4>
        constant invariant
        elt0:  <integer_cst 0xb7f07bb8 constant invariant 1>
        elt1:  <integer_cst 0xb7f0a510 constant invariant -1>> arg 1
<integer_cst 0xb7eee318 16>
    arg 2 <integer_cst 0xb7eee408 type <integer_type 0xb7ef6288 bit_size_type>
constant invariant 32>>

The problem is, that fold_ternary wants to access the third element of the
constant vector, which is not present.

The cause of this is, that fold_ternary fails, if it an element of the vector is
not initialized.

The change seem to be done by 
2005-06-01  Jakub Jelinek  <jakub@redhat.com>
* fold-const.c (fold_ternary): Optimize BIT_FIELD_REF of VECTOR_CST.

Replacing (in fold_ternary case BIT_FIELD_REF:)
        while (idx-- > 0)
                elements = TREE_CHAIN (elements);
              return TREE_VALUE (elements);
with
        while (idx-- > 0 && elements)
                elements = TREE_CHAIN (elements);
          if(elements)
              return TREE_VALUE (elements);
          else return build_int_cst_type(type,0);

should solve the problem.

-- 
           Summary: Segementation fault in fold_ternary
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: e9925248 at stud4 dot tuwien dot ac dot at
                CC: gcc-bugs at gcc dot gnu dot org,jakub at redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug middle-end/21897] [4.1 Regression] Segementation fault in fold_ternary
  2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
@ 2005-06-03 13:59 ` pinskia at gcc dot gnu dot org
  2005-06-03 14:02 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-03 13:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-03 13:59 -------
Confirmed, only -O1 is needed to cause the ICE.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|regression                  |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-03 13:59:22
               date|                            |
            Summary|Segementation fault in      |[4.1 Regression]
                   |fold_ternary                |Segementation fault in
                   |                            |fold_ternary
   Target Milestone|---                         |4.1.0


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


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

* [Bug middle-end/21897] [4.1 Regression] Segementation fault in fold_ternary
  2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
  2005-06-03 13:59 ` [Bug middle-end/21897] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-03 14:02 ` jakub at gcc dot gnu dot org
  2005-06-06 19:26 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-06-03 14:02 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-06-03 13:59:22         |2005-06-03 14:01:55
               date|                            |


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


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

* [Bug middle-end/21897] [4.1 Regression] Segementation fault in fold_ternary
  2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
  2005-06-03 13:59 ` [Bug middle-end/21897] [4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-06-03 14:02 ` jakub at gcc dot gnu dot org
@ 2005-06-06 19:26 ` cvs-commit at gcc dot gnu dot org
  2005-06-07 15:27 ` pinskia at gcc dot gnu dot org
  2005-07-08 14:11 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-06 19:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-06 19:26 -------
Subject: Bug 21897

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jakub@gcc.gnu.org	2005-06-06 19:26:10

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20050604-1.c 

Log message:
	* fold-const.c (operand_equal_p): Don't return 1, if element
	chains for 2 VECTOR_CSTs are not the same length.
	
	PR regression/21897
	* fold-const.c (fold_ternary) <case BIT_FIELD_REF>: Don't crash if
	not all VECTOR_CST elements are given.
	
	* gcc.c-torture/execute/20050604-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9055&r2=2.9056
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.591&r2=1.592
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5603&r2=1.5604
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050604-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/21897] [4.1 Regression] Segementation fault in fold_ternary
  2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
                   ` (2 preceding siblings ...)
  2005-06-06 19:26 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-07 15:27 ` pinskia at gcc dot gnu dot org
  2005-07-08 14:11 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-07 15:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-07 15:27 -------
Fixed.

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


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


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

* [Bug middle-end/21897] [4.1 Regression] Segementation fault in fold_ternary
  2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
                   ` (3 preceding siblings ...)
  2005-06-07 15:27 ` pinskia at gcc dot gnu dot org
@ 2005-07-08 14:11 ` cvs-commit at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-08 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-08 14:11 -------
Subject: Bug 21897

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-rhl-branch
Changes by:	jakub@gcc.gnu.org	2005-07-08 14:10:56

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: 20050604-1.c 

Log message:
	* fold-const.c (operand_equal_p): Don't return 1, if element
	chains for 2 VECTOR_CSTs are not the same length.
	
	PR regression/21897
	* fold-const.c (fold) <case BIT_FIELD_REF>: Don't crash if
	not all VECTOR_CST elements are given.
	
	* gcc.c-torture/execute/20050604-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=2.7592.2.10.2.42&r2=2.7592.2.10.2.43
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.517.4.9&r2=1.517.4.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=1.5084.2.9.2.36&r2=1.5084.2.9.2.37
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/20050604-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-rhl-branch&r1=NONE&r2=1.1.8.1



-- 


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


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

end of thread, other threads:[~2005-07-08 14:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-03  9:13 [Bug regression/21897] New: Segementation fault in fold_ternary e9925248 at stud4 dot tuwien dot ac dot at
2005-06-03 13:59 ` [Bug middle-end/21897] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-06-03 14:02 ` jakub at gcc dot gnu dot org
2005-06-06 19:26 ` cvs-commit at gcc dot gnu dot org
2005-06-07 15:27 ` pinskia at gcc dot gnu dot org
2005-07-08 14:11 ` cvs-commit 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).