public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/30280]  New: SIGSEGV on operator==(valarray<bool>, bool)
@ 2006-12-22 19:46 sebor at roguewave dot com
  2006-12-22 19:52 ` [Bug libstdc++/30280] " pinskia at gcc dot gnu dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: sebor at roguewave dot com @ 2006-12-22 19:46 UTC (permalink / raw)
  To: gcc-bugs

The (strictly speaking ill-formed) program below successfully compiles with
gcc 4.1.0 but fails with a SIGSEGV at runtime. I think it should either fail
to compile or, if it compiles because of a gcc extension, it should also run
successfully to completion.

$ cat u.cpp && g++ u.cpp && ./a.out
#include <cassert>
#include <valarray>

int main ()
{
    std::valarray<bool> a (1);

    assert (a == false);
}

Segmentation Fault (core dumped)


-- 
           Summary: SIGSEGV on operator==(valarray<bool>, bool)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
@ 2006-12-22 19:52 ` pinskia at gcc dot gnu dot org
  2006-12-22 20:22 ` sebor at roguewave dot com
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-22 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-22 19:52 -------
What target is this one, all I get is:
t.cc:8: error: cannot convert 'std::_Expr<std::_UnClos<std::__logical_not,
std::_Expr, std::_UnClos<std::__logical_not, std::_Expr,
std::_BinClos<std::__equal_to, std::_ValArray, std::_Constant, bool, bool> > >,
bool>' to 'long int' for argument '1' to 'long int __builtin_expect(long int,
long int)'


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
  2006-12-22 19:52 ` [Bug libstdc++/30280] " pinskia at gcc dot gnu dot org
@ 2006-12-22 20:22 ` sebor at roguewave dot com
  2006-12-22 21:42 ` pcarlini at suse dot de
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: sebor at roguewave dot com @ 2006-12-22 20:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sebor at roguewave dot com  2006-12-22 20:22 -------
(In reply to comment #1)

This was gcc 4.1.0 on sparc-sun-solaris2.9.


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
  2006-12-22 19:52 ` [Bug libstdc++/30280] " pinskia at gcc dot gnu dot org
  2006-12-22 20:22 ` sebor at roguewave dot com
@ 2006-12-22 21:42 ` pcarlini at suse dot de
  2006-12-22 22:17 ` ebotcazou at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pcarlini at suse dot de @ 2006-12-22 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2006-12-22 21:42 -------
Hi. In fact, I'm getting the same as Andrew on x86-linux, x86_64-linux and
powerpc-darwin. Seems a really weird target-dependent issue, I hope Eric can
help, a minimum of debugging, a backtrace (thanks in advance, anyway)


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at libertysurf dot
                   |                            |fr


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (2 preceding siblings ...)
  2006-12-22 21:42 ` pcarlini at suse dot de
@ 2006-12-22 22:17 ` ebotcazou at gcc dot gnu dot org
  2006-12-22 22:25 ` sebor at roguewave dot com
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-12-22 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ebotcazou at gcc dot gnu dot org  2006-12-22 22:17 -------
No SIGSEGV for me with 4.1.1:

gax% ./pr30280
Assertion failed: a == false, file pr30280.C, line 7
zsh: IOT instruction (core dumped)  ./pr30280

Please provide the missing info as per http://gcc.gnu.org/bugs.html


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (3 preceding siblings ...)
  2006-12-22 22:17 ` ebotcazou at gcc dot gnu dot org
@ 2006-12-22 22:25 ` sebor at roguewave dot com
  2006-12-22 23:01 ` pcarlini at suse dot de
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: sebor at roguewave dot com @ 2006-12-22 22:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from sebor at roguewave dot com  2006-12-22 22:25 -------
Regardless of whether the program aborts with SIGSEGV or SIGABRT, the point is
that it should either not compile or it should run succesfully to completion.

Here's the output of g++ -v if it helps:

$ g++ -v
Using built-in specs.
Target: sparc-sun-solaris2.9
Configured with: /build/sebor/gcc-4.1.0/configure --enable-languages=c,c++
--prefix=/usr/local/gcc-4.1.0 : (reconfigured) /build/sebor/gcc-4.1.0/configure
--enable-languages=c,c++ --prefix=/usr/local/gcc-4.1.0 : (reconfigured)
/build/sebor/gcc-4.1.0/configure --enable-languages=c,c++
--prefix=/usr/local/gcc-4.1.0 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 4.1.0


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (4 preceding siblings ...)
  2006-12-22 22:25 ` sebor at roguewave dot com
@ 2006-12-22 23:01 ` pcarlini at suse dot de
  2006-12-23  8:05 ` ebotcazou at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pcarlini at suse dot de @ 2006-12-22 23:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2006-12-22 23:01 -------
Yes, the "crazy" thing is that apparently the snippet *compiles* only on
sparc-solaris (and shouldn't, of course).


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (5 preceding siblings ...)
  2006-12-22 23:01 ` pcarlini at suse dot de
@ 2006-12-23  8:05 ` ebotcazou at gcc dot gnu dot org
  2006-12-23 11:17 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-12-23  8:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ebotcazou at gcc dot gnu dot org  2006-12-23 08:05 -------
> Here's the output of g++ -v if it helps:

Thanks, but we still need the preprocessed sources...


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (6 preceding siblings ...)
  2006-12-23  8:05 ` ebotcazou at gcc dot gnu dot org
@ 2006-12-23 11:17 ` gdr at integrable-solutions dot net
  2006-12-23 18:50   ` Andrew Pinski
  2006-12-23 18:50 ` pinskia at gmail dot com
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 17+ messages in thread
From: gdr at integrable-solutions dot net @ 2006-12-23 11:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from gdr at integrable-solutions dot net  2006-12-23 11:17 -------
Subject: Re:  SIGSEGV on operator==(valarray<bool>, bool)

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| What target is this one, all I get is:
| t.cc:8: error: cannot convert 'std::_Expr<std::_UnClos<std::__logical_not,
| std::_Expr, std::_UnClos<std::__logical_not, std::_Expr,
| std::_BinClos<std::__equal_to, std::_ValArray, std::_Constant, bool, bool> >
>,
| bool>' to 'long int' for argument '1' to 'long int __builtin_expect(long int,
| long int)'

I don't remember I ever used this funky __builtin_expect.  
valarray is improving everyday :-(

-- Gaby


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (7 preceding siblings ...)
  2006-12-23 11:17 ` gdr at integrable-solutions dot net
@ 2006-12-23 18:50 ` pinskia at gmail dot com
  2006-12-23 20:46 ` sebor at roguewave dot com
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gmail dot com @ 2006-12-23 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gmail dot com  2006-12-23 18:50 -------
Subject: Re:  SIGSEGV on operator==(valarray<bool>,
        bool)

On Sat, 2006-12-23 at 11:17 +0000, gdr at integrable-solutions dot net
wrote:
> 
> I don't remember I ever used this funky __builtin_expect.  
> valarray is improving everyday :-(


You most likely did not but assert did :).

-- Pinski


-- 


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


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

* Re: [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>,  bool)
  2006-12-23 11:17 ` gdr at integrable-solutions dot net
@ 2006-12-23 18:50   ` Andrew Pinski
  0 siblings, 0 replies; 17+ messages in thread
From: Andrew Pinski @ 2006-12-23 18:50 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Sat, 2006-12-23 at 11:17 +0000, gdr at integrable-solutions dot net
wrote:
> 
> I don't remember I ever used this funky __builtin_expect.  
> valarray is improving everyday :-(


You most likely did not but assert did :).

-- Pinski


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (8 preceding siblings ...)
  2006-12-23 18:50 ` pinskia at gmail dot com
@ 2006-12-23 20:46 ` sebor at roguewave dot com
  2006-12-24  4:56 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: sebor at roguewave dot com @ 2006-12-23 20:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from sebor at roguewave dot com  2006-12-23 20:46 -------
Created an attachment (id=12840)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12840&action=view)
preprocessed source


-- 


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


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

* [Bug libstdc++/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (9 preceding siblings ...)
  2006-12-23 20:46 ` sebor at roguewave dot com
@ 2006-12-24  4:56 ` pinskia at gcc dot gnu dot org
  2006-12-24  5:02 ` [Bug target/30280] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-24  4:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2006-12-24 04:56 -------
So on solaris assert is defined as
(void)((operand) || (__assert (),0) );


-- 


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


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

* [Bug target/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (10 preceding siblings ...)
  2006-12-24  4:56 ` pinskia at gcc dot gnu dot org
@ 2006-12-24  5:02 ` pinskia at gcc dot gnu dot org
  2006-12-24  5:23 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-24  5:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2006-12-24 05:02 -------
I am starting to think Solaris's definition of assert is incorrect because you
can actually overload "operator ||" and force evulation of both operands in C++
which is what is happening here.

All other asserts I know of use ?: which cannot be overloaded.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |target
 GCC target triplet|                            |sparc-sun-solaris2.9


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


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

* [Bug target/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (11 preceding siblings ...)
  2006-12-24  5:02 ` [Bug target/30280] " pinskia at gcc dot gnu dot org
@ 2006-12-24  5:23 ` gdr at integrable-solutions dot net
  2007-04-08 22:52 ` pinskia at gcc dot gnu dot org
  2008-11-30  9:45 ` ebotcazou at gcc dot gnu dot org
  14 siblings, 0 replies; 17+ messages in thread
From: gdr at integrable-solutions dot net @ 2006-12-24  5:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from gdr at integrable-solutions dot net  2006-12-24 05:23 -------
Subject: Re:  SIGSEGV on operator==(valarray<bool>, bool)

"pinskia at gmail dot com" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Comment #9 from pinskia at gmail dot com  2006-12-23 18:50 -------
| Subject: Re:  SIGSEGV on operator==(valarray<bool>,
|         bool)
| 
| On Sat, 2006-12-23 at 11:17 +0000, gdr at integrable-solutions dot net
| wrote:
| > 
| > I don't remember I ever used this funky __builtin_expect.  
| > valarray is improving everyday :-(
| 
| 
| You most likely did not but assert did :).

Doh.  You're right;


-- 


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


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

* [Bug target/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (12 preceding siblings ...)
  2006-12-24  5:23 ` gdr at integrable-solutions dot net
@ 2007-04-08 22:52 ` pinskia at gcc dot gnu dot org
  2008-11-30  9:45 ` ebotcazou at gcc dot gnu dot org
  14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-08 22:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from pinskia at gcc dot gnu dot org  2007-04-08 23:52 -------
I really don't think this is a bug as explained in comment #11.  It just
happens assert is defined weird on solaris.


-- 


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


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

* [Bug target/30280] SIGSEGV on operator==(valarray<bool>, bool)
  2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
                   ` (13 preceding siblings ...)
  2007-04-08 22:52 ` pinskia at gcc dot gnu dot org
@ 2008-11-30  9:45 ` ebotcazou at gcc dot gnu dot org
  14 siblings, 0 replies; 17+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-11-30  9:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from ebotcazou at gcc dot gnu dot org  2008-11-30 09:43 -------
Not reproducible.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME


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


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

end of thread, other threads:[~2008-11-30  9:45 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-22 19:46 [Bug libstdc++/30280] New: SIGSEGV on operator==(valarray<bool>, bool) sebor at roguewave dot com
2006-12-22 19:52 ` [Bug libstdc++/30280] " pinskia at gcc dot gnu dot org
2006-12-22 20:22 ` sebor at roguewave dot com
2006-12-22 21:42 ` pcarlini at suse dot de
2006-12-22 22:17 ` ebotcazou at gcc dot gnu dot org
2006-12-22 22:25 ` sebor at roguewave dot com
2006-12-22 23:01 ` pcarlini at suse dot de
2006-12-23  8:05 ` ebotcazou at gcc dot gnu dot org
2006-12-23 11:17 ` gdr at integrable-solutions dot net
2006-12-23 18:50   ` Andrew Pinski
2006-12-23 18:50 ` pinskia at gmail dot com
2006-12-23 20:46 ` sebor at roguewave dot com
2006-12-24  4:56 ` pinskia at gcc dot gnu dot org
2006-12-24  5:02 ` [Bug target/30280] " pinskia at gcc dot gnu dot org
2006-12-24  5:23 ` gdr at integrable-solutions dot net
2007-04-08 22:52 ` pinskia at gcc dot gnu dot org
2008-11-30  9:45 ` ebotcazou 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).