public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27472]  New: ice for legal code
@ 2006-05-07 16:30 dcb314 at hotmail dot com
  2006-05-07 17:04 ` [Bug rtl-optimization/27472] ICE with -fsee -O2 pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2006-05-07 16:30 UTC (permalink / raw)
  To: gcc-bugs

I just tried to compile a small piece of source code with
the new GNU C compiler version 4.2 snapshot 20060506. 

The compiler snapshot said

dcb@linux:~/gnu/42-20060506/bugs> ~/gnu/42-20060506/results/bin/g++ -c -O3
bug16.cc
bug16.cc: In function 'bool cross(const LineSegment&, const LineSegment&)':
bug16.cc:49: 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.

Preprocessed source code attached.  Flag -O3 required.
This code compiled ok on the previous snapshot 20060429.

Valgrind says the following

==9134== Invalid read of size 2
==9134==    at 0x98D8F7: hash_descriptor_pre_extension (see.c:837)
==9134==    by 0x9C92E1: htab_find_slot (hashtab.c:657)
==9134==    by 0x98E5B7: see_seek_pre_extension_expr (see.c:1036)
==9134==    by 0x98E6E7: see_set_prop_unmerged_def (see.c:2280)
==9134==    by 0x9C89F7: htab_traverse_noresize (hashtab.c:729)
==9134==    by 0x98E497: see_handle_extensions_for_one_ref (see.c:2986)
==9134==    by 0x9C9B68: splay_tree_foreach_helper (splay-tree.c:218)
==9134==    by 0x990D10: see_main (see.c:3021)
==9134==    by 0x9913D5: rest_of_handle_see (see.c:3754)
==9134==    by 0x88E24A: execute_one_pass (passes.c:864)
==9134==    by 0x88E3BB: execute_pass_list (passes.c:911)
==9134==    by 0x88E3CD: execute_pass_list (passes.c:912)
==9134==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

The source code is

struct Point
{
 float x;
 float y;
};

struct LineSegment
{
 Point start;
 Point end;
};

inline float min( float x, float y)
{
 return (x < y) ? x : y;
}

inline float max( float x, float y)
{
 return (x > y) ? x : y;
}

bool
cross( const LineSegment & ls1, const LineSegment & ls2)
{
 const float slope1 = (ls1.end.y - ls1.start.y) / (ls1.end.x - ls1.start.x);
 const float intercept1 = ls1.end.y - (slope1 * ls1.end.x);

 const float slope2 = (ls2.end.y - ls2.start.y) / (ls2.end.x - ls2.start.x);
 const float intercept2 = ls2.end.y - (slope2 * ls2.end.x);

 if (slope1 == slope2)
 {
  return (intercept1 == intercept2);
 }
 const float x = (intercept1 - intercept2) / (slope2 - slope1);

 const float ls1minx = min( ls1.start.x, ls1.end.x);
 const float ls1maxx = max( ls1.start.x, ls1.end.x);

 if ((ls1minx < x) && (x < ls1maxx))
 {
  const float ls2minx = min( ls2.start.x, ls2.end.x);
  const float ls2maxx = max( ls2.start.x, ls2.end.x);

  return (ls2minx < x) && (x < ls2maxx);
 }
}


-- 
           Summary: ice for legal code
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug rtl-optimization/27472] ICE with -fsee -O2
  2006-05-07 16:30 [Bug c++/27472] New: ice for legal code dcb314 at hotmail dot com
@ 2006-05-07 17:04 ` pinskia at gcc dot gnu dot org
  2006-05-07 21:44 ` dcb314 at hotmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-07 17:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-05-07 17:04 -------
-fsee has now been turned off by default so this is not  a regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |rtl-optimization
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|                            |i686-pc-linux-gnu
            Summary|ice for legal code          |ICE with -fsee -O2


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


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

* [Bug rtl-optimization/27472] ICE with -fsee -O2
  2006-05-07 16:30 [Bug c++/27472] New: ice for legal code dcb314 at hotmail dot com
  2006-05-07 17:04 ` [Bug rtl-optimization/27472] ICE with -fsee -O2 pinskia at gcc dot gnu dot org
@ 2006-05-07 21:44 ` dcb314 at hotmail dot com
  2006-05-07 23:30 ` pinskia at gcc dot gnu dot org
  2006-05-29 22:32 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2006-05-07 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dcb314 at hotmail dot com  2006-05-07 21:44 -------
(In reply to comment #1)
> -fsee has now been turned off by default so this is not  a regression.

By "now" do you mean before or after the 20060506 snapshot ?

The code used to compile on the previous snapshot,
it doesn't compile with the current snapshot.

That sounds like a regression to me.


-- 


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


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

* [Bug rtl-optimization/27472] ICE with -fsee -O2
  2006-05-07 16:30 [Bug c++/27472] New: ice for legal code dcb314 at hotmail dot com
  2006-05-07 17:04 ` [Bug rtl-optimization/27472] ICE with -fsee -O2 pinskia at gcc dot gnu dot org
  2006-05-07 21:44 ` dcb314 at hotmail dot com
@ 2006-05-07 23:30 ` pinskia at gcc dot gnu dot org
  2006-05-29 22:32 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-07 23:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-05-07 23:30 -------
(In reply to comment #2)
> (In reply to comment #1)
> > -fsee has now been turned off by default so this is not  a regression.
> 
> By "now" do you mean before or after the 20060506 snapshot ?
Now meaning today:
http://gcc.gnu.org/ml/gcc-cvs/2006-05/msg00199.html


-- 


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


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

* [Bug rtl-optimization/27472] ICE with -fsee -O2
  2006-05-07 16:30 [Bug c++/27472] New: ice for legal code dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2006-05-07 23:30 ` pinskia at gcc dot gnu dot org
@ 2006-05-29 22:32 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 22:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-05-29 22:32 -------


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


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-05-29 22:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-07 16:30 [Bug c++/27472] New: ice for legal code dcb314 at hotmail dot com
2006-05-07 17:04 ` [Bug rtl-optimization/27472] ICE with -fsee -O2 pinskia at gcc dot gnu dot org
2006-05-07 21:44 ` dcb314 at hotmail dot com
2006-05-07 23:30 ` pinskia at gcc dot gnu dot org
2006-05-29 22:32 ` 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).