From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 525883858431 for ; Tue, 16 Nov 2021 02:23:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 525883858431 Received: by mail-pj1-x1033.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso1474344pjo.3 for ; Mon, 15 Nov 2021 18:23:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=OPx8yqoMgTfXTWdBiClB4u3pv/NMj03VvCgxl1zx7mY=; b=vFiGOUxDEcTsVLLHjo6f2cdye2Z40RHpEcoMy3gc0JHLjf4IK1d71tmDQBIecDMYZi NEz+npw9vapUiOCgmo4q2vitwN3DspsvwoqCTNGmW/CUAniz61MkPZRP8g2nuneV13n1 c32dW8JDd1bLyBumOvHSRAqRfB33fPgE0EM6IAfkzO54yt3cB2waNwLWg582jV75qd4D tq+OeYMpJffUJflfPnHfYNHLuTTIgzBXsxrddHX38NjPclwPIdxO+uJFb/PPLOMeDVZu Gd/IJfhaavB7enUiPBCSc5OcFD1xstO/buBpH5gJ3H2V7OCPgv4DVL4pk4PoXjIjO2VR ujxQ== X-Gm-Message-State: AOAM531SWFMOGbGuz/ZM4nGqb4Y4wY4zzEzu3f1ps7Y/aAFSd2ydMUXC 2nE2v+KH/78ncpBfPJBlxA8= X-Google-Smtp-Source: ABdhPJzMQ3haZTImoc9i8ITeKh267RydycWC7GrPK2pUPQbo/r2oOvmzvUBur7JRtJ+m0KE6vPRi6w== X-Received: by 2002:a17:902:ec90:b0:142:269:4691 with SMTP id x16-20020a170902ec9000b0014202694691mr41606470plg.48.1637029422475; Mon, 15 Nov 2021 18:23:42 -0800 (PST) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id y32sm18586700pfa.145.2021.11.15.18.23.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Nov 2021 18:23:42 -0800 (PST) Message-ID: <6e0cafbb-ef87-4e4e-d548-e8c077a4b05b@gmail.com> Date: Mon, 15 Nov 2021 19:23:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] Avoid pathological function redeclarations when checking access sizes [PR102759] Content-Language: en-US To: Martin Sebor , gcc-patches References: From: Jeff Law In-Reply-To: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2021 02:23:44 -0000 On 11/15/2021 1:31 PM, Martin Sebor via Gcc-patches wrote: > Declaring a function with a prototype at block scope and > then redeclaring it without a prototype at file scope results > in losing the prototype but not the attribute access that was > implicitly added to the function decl based on the prototype. > The middle end code that checks function calls for out-of-bounds > accesses based on the attribute is unprepared for this case and > fails with an ICE.  The attached patch corrects this by having > it ignore these pathological cases.  In addition, the change > also improves the format of the informational note printed > after these warnings to reflect the form of the argument > (e.g., to print int[7] rather than int * if the former was > the form used in the declaration). > > Tested on x86_64-linux. > > Martin > > gcc-102759.diff > > Avoid pathological function redeclarations when checking access sizes [PR102759]. > > Resolves: > PR tree-optimization/102759 - ICE: Segmentation fault in maybe_check_access_sizes since r12-2976-gb48d4e6818674898 > > PR tree-optimization/102759 > > gcc/ChangeLog: > > PR tree-optimization/102759 > * gimple-array-bounds.cc (build_printable_array_type): Move... > * gimple-ssa-warn-access.cc (build_printable_array_type): Avoid > pathological function redeclarations that remove a previously > declared prototype. > Improve formatting of function arguments in informational notes. > * pointer-query.cc (build_printable_array_type): ...to here. > * pointer-query.h (build_printable_array_type): Declared. > > gcc/testsuite/ChangeLog: > > PR tree-optimization/102759 > * gcc.dg/Warray-parameter-10.c: New test. > * gcc.dg/Wstringop-overflow-82.c: New test. OK jeff