This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING #3] [PATCH] handle enumerated types in -Wformat-overflow (PR 80397)


Jeff, I suspect you're still busy but I'm Looking for approval
to commit the nearly trivial patch below:

  https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00547.html

Martin

On 05/22/2017 08:19 PM, Martin Sebor wrote:
Ping:

  https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00547.html

On 05/15/2017 09:01 PM, Martin Sebor wrote:
Ping: Jeff, is this patch approved?
  https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00547.html

On 05/08/2017 08:38 PM, Martin Sebor wrote:
On 04/28/2017 12:35 PM, Jeff Law wrote:
On 04/26/2017 11:05 AM, Martin Sebor wrote:
On 04/24/2017 03:35 PM, Jeff Law wrote:
On 04/11/2017 12:57 PM, Martin Sebor wrote:
In a review of my fix for bug 80364 Jakub pointed out that to
determine whether an argument to an integer directive is of
an integer type the gimple-ssa-sprintf pass tests the type code
for equality to INTEGER_TYPE when it should instead be using
INTEGRAL_TYPE_P().  This has the effect of the pass being unable
to use the available range of arguments of enumerated types,
resulting in both false positives and false negatives, and in
some cases, in emitting suboptimal code.

The attached patch replaces those tests with INTEGRAL_TYPE_P().

Since this is not a regression I submit it for GCC 8.
You might consider using POINTER_TYPE_P as well.

You mean rather than (TREE_CODE (type) == POINTER_TYPE)?  Those
I believe are vestiges of the %p handling that was removed sometime
last year, and (unless you are recommending I remove them as part
of this patch) should probably be removed during the next cleanup.Yes,
that can be a follow-up cleanup.

For the future, if you find yourself writing something like
TREE_CODE (TREE_TYPE (x)) == POINTER_TYPE, you're usually going to be
better off using POINTER_TYPE_P (TREE_TYPE (x)).  That allows the code
to work with C++ references as well as C pointers.

I'll keep it in mind, thanks.  Should I take this as approval
of the patch as is or are there some changes you'd like me to
make?

Martin




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]