public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Jason Merrill <jason@redhat.com>,
	 Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PING 2] [PATCH] c++/67942 - diagnose placement new buffer overflow
Date: Sun, 08 Nov 2015 18:10:00 -0000	[thread overview]
Message-ID: <563F901A.4080707@gmail.com> (raw)
In-Reply-To: <87d1vngum2.fsf@igel.home>

On 11/06/2015 05:50 AM, Andreas Schwab wrote:
> I see this failure on m68k:
>
> FAIL: g++.dg/warn/Wplacement-new-size.C  -std=gnu++11 (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:189:19: warning: placement new constructing an object of type 'int' and size '4' in a region of type 'char [4]' and size '0' [-Wplacement-new]
> /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:191:19: warning: placement new constructing an object of type 'int' and size '4' in a region of type 'char [4]' and size '0' [-Wplacement-new]
> /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:194:19: warning: placement new constructing an object of type 'int' and size '4' in a region of type 'char [4]' and size '0' [-Wplacement-new]
> /daten/aranym/gcc/gcc-20151106/gcc/testsuite/g++.dg/warn/Wplacement-new-size.C:198:19: warning: placement new constructing an object of type 'int' and size '4' in a region of type 'char [4]' and size '0' [-Wplacement-new]
>
> That appears to be a 32-bit problem, the test also fails here on x86-64
> with -m32 <http://gcc.gnu.org/ml/gcc-testresults/2015-11/msg00522.html>
> or here on powerpc
> <http://gcc.gnu.org/ml/gcc-testresults/2015-11/msg00520.html>

This should be fixed now via r229959 (tested on x86_64 with -m32).

The problem was caused by assuming that the POINTER_PLUS_EXPR offset
which is stored as sizetype, an unsigned 32-bit type in ILP32, can
be "extracted" as an unsigned HOST_WIDE_INT (a 64-bit type when
the host compiler is LP64), and converted to signed to obtain the
original negative offset.

Martin

  reply	other threads:[~2015-11-08 18:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 17:23 Martin Sebor
2015-10-21  0:03 ` [PING] " Martin Sebor
2015-10-27  2:07   ` [PING 2] " Martin Sebor
2015-11-03  2:41     ` Jason Merrill
2015-11-04 17:12       ` Martin Sebor
2015-11-04 19:12         ` Jason Merrill
2015-11-05  0:15           ` Martin Sebor
2015-11-05  4:27             ` Jason Merrill
2015-11-05 15:13               ` Martin Sebor
2015-11-05 15:27                 ` Jason Merrill
2015-11-05 16:52                   ` Martin Sebor
2015-11-05 18:13                     ` Jason Merrill
2015-11-05 23:41                       ` Martin Sebor
2015-11-06  1:10                         ` Martin Sebor
2015-11-06 12:50                     ` Andreas Schwab
2015-11-08 18:10                       ` Martin Sebor [this message]
2015-11-06 12:55                     ` Rainer Orth
2015-11-06 15:28                       ` Martin Sebor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563F901A.4080707@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).