[Bug c++/87542] [7/8/9 Regression] bogus error on attribute format with a named constant argument

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 15 22:54:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87542

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Author: msebor
Date: Thu Nov 15 22:53:57 2018
New Revision: 266195

URL: https://gcc.gnu.org/viewcvs?rev=266195&root=gcc&view=rev
Log:
PR c++/87541 - ICE using a constant decl as an attribute alloc_size argument
PR c++/87542 - bogus error on attribute format with a named constant argument

gcc/ChangeLog:

        PR c++/87541
        PR c++/87542
        * tree.c (type_argument_type): New function.
        * tree.h (type_argument_type): Declare it.
        * gcc/doc/extend.texi (alloc_align): Update and clarify.
        (alloc_size, nonnull, sentinel): Same.

gcc/c-family/ChangeLog:

        PR c++/87541
        PR c++/87542
        * c-attribs.c (positional_argument): New function.
        (handle_alloc_size_attribute): Use it and simplify.
        (handle_alloc_align_attribute): Same.
        (handle_assume_aligned_attribute): Same.
        (handle_nonnull_attribute): Same.
        * c-common.c (check_function_arguments): Pass fntype to
        check_function_format.
        * c-common.h (check_function_format): Add an argument.
        (PosArgFlags, positional_argument): Declare new type and function.
        * c-format.c (decode_format_attr): Add arguments.
        (check_format_string, get_constant): Same.
        (convert_format_name_to_system_name): Adjust.

gcc/testsuite/ChangeLog:

        PR c++/87541
        PR c++/87542
        * g++.dg/ext/attr-alloc_size.C: New test.
        * c-c++-common/pr71574.c: Adjust diagnostics.
        * c-c++-common/attributes-1.c: Same.
        * gcc.dg/attr-alloc_align-2.c: Same.
        * gcc.dg/attr-alloc_align-4.c: New test.
        * gcc.dg/attr-alloc_size-2.c: Adjust diagnostics.
        * gcc.dg/attr-alloc_size.c: Same.
        * gcc.dg/attr-assume_aligned-4.c: New test.
        * gcc.dg/format/attr-3.c: Adjust diagnostics.
        * gcc.dg/nonnull-2.c: Same.
        * gcc.dg/torture/pr80612.c: Same.
        * obj-c++.dg/attributes/method-format-1.mm: Same.
        * obj-c++.dg/attributes/method-nonnull-1.mm: Same.
        * objc.dg/attributes/method-format-1.m: same.
        * objc.dg/attributes/method-nonnull-1.m: Same.


Added:
    trunk/gcc/testsuite/g++.dg/ext/attr-alloc_size.C
    trunk/gcc/testsuite/gcc.dg/attr-alloc_align-4.c
    trunk/gcc/testsuite/gcc.dg/attr-alloc_size-12.c
    trunk/gcc/testsuite/gcc.dg/attr-assume_aligned-4.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-attribs.c
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c-format.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/attributes-1.c
    trunk/gcc/testsuite/c-c++-common/pr71574.c
    trunk/gcc/testsuite/gcc.dg/attr-alloc_align-2.c
    trunk/gcc/testsuite/gcc.dg/attr-alloc_size-2.c
    trunk/gcc/testsuite/gcc.dg/attr-alloc_size.c
    trunk/gcc/testsuite/gcc.dg/format/attr-3.c
    trunk/gcc/testsuite/gcc.dg/nonnull-2.c
    trunk/gcc/testsuite/gcc.dg/torture/pr80612.c
    trunk/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm
    trunk/gcc/testsuite/obj-c++.dg/attributes/method-nonnull-1.mm
    trunk/gcc/testsuite/objc.dg/attributes/method-format-1.m
    trunk/gcc/testsuite/objc.dg/attributes/method-nonnull-1.m
    trunk/gcc/tree.c
    trunk/gcc/tree.h


More information about the Gcc-bugs mailing list