linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Moore, Robert'" <robert.moore@intel.com>, Qian Cai <cai@lca.pw>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>
Cc: "Schmauss, Erik" <erik.schmauss@intel.com>,
	"jkim@FreeBSD.org" <jkim@FreeBSD.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"ndesaulniers@google.com" <ndesaulniers@google.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"devel@acpica.org" <devel@acpica.org>,
	"clang-built-linux@googlegroups.com" 
	<clang-built-linux@googlegroups.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings
Date: Mon, 29 Jul 2019 10:24:27 +0000	[thread overview]
Message-ID: <c98fa373a004472b979255a93b414fe1@AcuMS.aculab.com> (raw)
In-Reply-To: <94F2FBAB4432B54E8AACC7DFDE6C92E3B9661CBD@ORSMSX110.amr.corp.intel.com>

From: Moore, Robert
> Sent: 26 July 2019 20:36
...
> This is because pointer arithmetic
> on a pointer not pointing to an array is an undefined behavior (C11 6.5.6, constraint 8).
...

The standards committee as smoking dope again :-)
If that is enforced as a compiler warning/error a lot of code 'breaks'.
Anything that does:
	struct foo *foo = ...;
      struct bar *bar = (void *)(foo + 1);
suddenly becomes 'invalid'.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2019-07-29 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 19:48 [PATCH v2] acpica: fix -Wnull-pointer-arithmetic warnings Qian Cai
2019-07-26 19:35 ` Moore, Robert
2019-07-29 10:24   ` David Laight [this message]
2019-07-29 12:23     ` Qian Cai
2019-08-01 19:16   ` Qian Cai
2019-08-01 20:17     ` Schmauss, Erik
2019-08-01 20:28       ` Moore, Robert

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=c98fa373a004472b979255a93b414fe1@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=cai@lca.pw \
    --cc=clang-built-linux@googlegroups.com \
    --cc=devel@acpica.org \
    --cc=erik.schmauss@intel.com \
    --cc=jkim@FreeBSD.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    /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 NNTP newsgroup(s).