public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag
@ 2014-10-22 16:25 fuscated at gmail dot com
2014-10-22 17:29 ` [Bug c++/63619] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: fuscated at gmail dot com @ 2014-10-22 16:25 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4628 bytes --]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
Bug ID: 63619
Summary: warning: deleting âvoid*â is undefined has no -W flag
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fuscated at gmail dot com
Save this snippet in delete_void.cpp
int main() {
void *a=new char[100];
delete [] a;
return 0;
}
$ g++ -fdiagnostics-show-option delete_void.cpp
delete_void.cpp: In function âint main()â:
delete_void.cpp:3:12: warning: deleting âvoid*â is undefined
delete [] a;
^
The compiler poroduces a warning, but doesn't allow the user to turn it into
error and thus such bugs cannot be detected at compile time.
>From gcc-bugs-return-464673-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Oct 22 16:25:05 2014
Return-Path: <gcc-bugs-return-464673-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29259 invoked by alias); 22 Oct 2014 16:25:05 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29234 invoked by uid 48); 22 Oct 2014 16:25:02 -0000
From: "evstupac at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/63620] New: RELOAD lost SET_GOT dependency on Darwin
Date: Wed, 22 Oct 2014 16:25:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: evstupac at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc cf_gcctarget attachments.created
Message-ID: <bug-63620-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-10/txt/msg01694.txt.bz2
Content-length: 1918
https://gcc.gnu.org/bugzilla/show_bug.cgi?idc620
Bug ID: 63620
Summary: RELOAD lost SET_GOT dependency on Darwin
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: evstupac at gmail dot com
CC: law at redhat dot com, vmakarov at redhat dot com
Target: Darwin
Created attachment 33782
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id3782&actioníit
reproducer
For the attached tests even with fix in pr63618 SET_GOT is deleted on Darwin.
For some reason there are no dependency between:
(RELOAD PASS)
(insn/f 43 6 2 2 (parallel [
(set (reg:SI 0 ax [87])
(unspec:SI [
(const_int 0 [0])
] UNSPEC_SET_GOT))
(clobber (reg:CC 17 flags))
]) 679 {set_got}
(expr_list:REG_EQUIV (unspec:SI [
(const_int 0 [0])
] UNSPEC_SET_GOT)
(expr_list:REG_CFA_FLUSH_QUEUE (nil)
(nil))))
and
(insn 46 17 47 3 (set (reg:SI 0 ax [93])
(plus:SI (reg:SI 0 ax [87])
(const:SI (unspec:SI [
(symbol_ref/u:SI ("*LC0") [flags 0x2])
] UNSPEC_MACHOPIC_OFFSET)))) elim_setgot_darwin.c:20 213
{*leasi}
(expr_list:REG_EQUAL (symbol_ref/u:SI ("*LC0") [flags 0x2])
(nil)))
And at 231r.ce3 SET_GOT is deleted which lead to incorrect code.
The issue reproduced on Darwin only, however it can be reproduced at cross
build configured as:
../configure --target=x86_64-apple-darwin11 --prefix=...
--enable-languages=c,c++ --enable-bootstrap=no
To reproduce we need only cc1:
gcc/cc1 elim_setgot_darwin.c -m32 -fPIE -O2 -msse4.2 -mtune=corei7 -fno-inline
-fdump-rtl-all
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
@ 2014-10-22 17:29 ` redi at gcc dot gnu.org
2014-10-22 17:47 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-22 17:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-10-22
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, this is a very good candidate for wanting a -Werror=xxx option
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
2014-10-22 17:29 ` [Bug c++/63619] " redi at gcc dot gnu.org
@ 2014-10-22 17:47 ` redi at gcc dot gnu.org
2014-10-22 21:35 ` fuscated at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-22 17:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The simplest fix would be:
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -478,7 +478,7 @@ delete_sanity (tree exp, tree size, bool doing_vec, int
use_global_delete,
/* Deleting ptr to void is undefined behavior [expr.delete/3]. */
if (VOID_TYPE_P (TREE_TYPE (type)))
{
- warning (0, "deleting %qT is undefined", type);
+ warning (OPT_Wdelete_incomplete, "deleting %qT is undefined", type);
doing_vec = 0;
}
Although it's possible someone would want deleting void to be an error but not
deleting an incomplete type (because it's only undefined to delete an
incomplete type if it has a non-trivial destructor or a custom deallocation
function).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
2014-10-22 17:29 ` [Bug c++/63619] " redi at gcc dot gnu.org
2014-10-22 17:47 ` redi at gcc dot gnu.org
@ 2014-10-22 21:35 ` fuscated at gmail dot com
2014-10-23 9:25 ` fuscated at gmail dot com
2014-10-23 21:08 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: fuscated at gmail dot com @ 2014-10-22 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
--- Comment #3 from Teodor Petrov <fuscated at gmail dot com> ---
We already use -Werror=delete-incomplete, so it will be easier for us, because
it will just work.
But if you ask me (as a user) it is best to just change the standard to force
these two as errors. I know this will never happen, but I have to murmur about
it.
BTW: Thanks for looking at this in such a short time :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
` (2 preceding siblings ...)
2014-10-22 21:35 ` fuscated at gmail dot com
@ 2014-10-23 9:25 ` fuscated at gmail dot com
2014-10-23 21:08 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: fuscated at gmail dot com @ 2014-10-23 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
--- Comment #4 from Teodor Petrov <fuscated at gmail dot com> ---
FYI: clang fixed the same issue by adding it to -Wdelete-incomplete
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/63619] warning: deleting ‘void*’ is undefined has no -W flag
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
` (3 preceding siblings ...)
2014-10-23 9:25 ` fuscated at gmail dot com
@ 2014-10-23 21:08 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-10-23 21:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63619
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Oct 23 21:07:49 2014
New Revision: 216599
URL: https://gcc.gnu.org/viewcvs?rev=216599&root=gcc&view=rev
Log:
PR c++/63619
gcc/cp:
PR c++/63619
* decl2.c (delete_sanity): Use OPT_Wdelete_incomplete in warning.
gcc/testsuite:
PR c++/63619
* g++.dg/warn/Wdelete-incomplete-3.C: New.
* g++.dg/warn/Wdelete-incomplete-4.C: New.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-3.C
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl2.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-23 21:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-22 16:25 [Bug c++/63619] New: warning: deleting ‘void*’ is undefined has no -W flag fuscated at gmail dot com
2014-10-22 17:29 ` [Bug c++/63619] " redi at gcc dot gnu.org
2014-10-22 17:47 ` redi at gcc dot gnu.org
2014-10-22 21:35 ` fuscated at gmail dot com
2014-10-23 9:25 ` fuscated at gmail dot com
2014-10-23 21:08 ` redi at gcc dot gnu.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).