public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>,
	Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>,
	Mike Stump <mikestump@comcast.net>,
	Jason Merrill <jason@redhat.com>, Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] testsuite: analyzer: expect alignment warning with -fshort-enums
Date: Sun, 19 Nov 2023 08:13:47 -0700	[thread overview]
Message-ID: <9174593a-066b-4735-86f3-51a670c3fbae@gmail.com> (raw)
In-Reply-To: <orh6liry88.fsf@lxoliva.fsfla.org>



On 11/19/23 00:36, Alexandre Oliva wrote:
> 
> On targets that have -fshort-enums enabled by default, the type casts
> in the pr108251 analyzer tests warn that the byte-aligned enums may
> not be sufficiently aligned to be a struct connection *.  The function
> can't know better, the warning is reasonable, the code doesn't
> expected enums to be shorter and less aligned than the struct.
> 
> Rather than use -fno-short-enums, I decided to embrace the warning on
> targets that have short_enums enabled by default.
> 
> However, C++ doesn't issue the warning, because even with
> -fshort-enums, enumeration types are not TYPE_PACKED, and the
> expression is not sufficiently simplified by the C++ front-end for
> check_and_warn_address_or_pointer_of_packed_member to identify the
> insufficiently aligned pointer.  So don't expect the warning there.
> 
> (I've got followup patches in testing to get the same warnings in C++)
> 
> Regstrapped on x86_64-linux-gnu, also tested on arm-eabi with default
> cpu on trunk, and with tms570 on gcc-13.  Ok to install?
> 
> 
> for  gcc/testsuite/ChangeLog
> 
> 	* c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c:
> 	Expect "unaligned pointer value" warning on short_enums
> 	targets, but not in c++.
> 	* c-c++-common/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c:
> 	Likewise.
OK.  Hell of a filename for a single test :-)

jeff

  reply	other threads:[~2023-11-19 15:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-19  7:36 Alexandre Oliva
2023-11-19 15:13 ` Jeff Law [this message]
2023-11-20 22:19   ` David Malcolm
2023-11-20  2:33 ` [PATCH #2/4] c++: mark short-enums as packed Alexandre Oliva
2023-11-20 19:55   ` Jason Merrill
2023-11-22  8:17     ` Alexandre Oliva
2023-11-22 18:12       ` Jason Merrill
2023-11-22 18:26         ` Jason Merrill
2023-11-29  9:39           ` Alexandre Oliva
2023-11-29 19:03             ` Jason Merrill
2023-11-30  7:21               ` Alexandre Oliva
2023-11-20  2:34 ` [PATCH #3/4] warn on cast of pointer to packed plus constant Alexandre Oliva
2023-11-20  2:34 ` [PATCH #4/4] testsuite: discard c++ exclusion on underaligned pointer warning Alexandre Oliva
2023-11-23 20:27   ` Mike Stump

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=9174593a-066b-4735-86f3-51a670c3fbae@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=nathan@acm.org \
    --cc=oliva@adacore.com \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /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).