This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32832] Seg fault on member function that does not return a val
- From: "CyrusOmega at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jul 2007 11:56:17 -0000
- Subject: [Bug c++/32832] Seg fault on member function that does not return a val
- References: <bug-32832-14884@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from CyrusOmega at gmail dot com 2007-07-20 11:56 -------
Subject: Re: Seg fault on member function that does not return a val
Is there ANY case where this action would NOT result in a segfault!?
Specifically, it is segfaulting because something is being freed that
was never created in the first place, or that has already been freed.
If my code doesn't say what to return, then shouldn't the compiler
either A) return the default object of the type the func will return
or B) give an error telling me to fix the problem.
I don't know what the spec says but this undefined behavior seems
rather serious and should either be a default warning or the compiler
should offer a consistent reaction.
I am not bashing gcc in any way, just expression the opinion of a long
timer coder that is trying to help make gcc even better. I will start
using -Wall for everything ;)
Thanks,
Andrew
On 20 Jul 2007 04:36:57 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #1 from pinskia at gcc dot gnu dot org 2007-07-20 04:36 -------
> This is only undefined behavior which is why we only warn about it.
>
>
> --
>
> pinskia at gcc dot gnu dot org changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|UNCONFIRMED |RESOLVED
> Resolution| |INVALID
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32832
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32832