From patchwork Tue Apr 3 20:54:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 894779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-475793-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="E41v3YPD"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40G1YF3QqBz9s0n for ; Wed, 4 Apr 2018 06:54:24 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=r0NHmODSO05yPd0+hCSnp+XD4ex3HfPjhkrf2iKimMxIORIOA2 B1zs4mXrQ3Br9tAqUTZHkE+meq+u2xzAiRfRkSwuc9PZua7swskeVuOGD6jRjp42 ET6OsOnZubcwfnW4qv2smRBuL/p0iNmMeEozAByJq36DuyprEEE+Xmx5I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=eOgplI7Tr6yxFsa8kA53mL0bwyA=; b=E41v3YPD0mbicDSrunCz f6VasvfWf265MHAl2um/dlMZo2vMv2GTOBdMYwRw96/K7SGC+HO6dzG+RQmyqlDz N7QtFq8KObl0ScCMe6R4mnFfQHfnRI3tTnykCU2IYPr0DOYdoD5V87rkI0H+TZxG GsvCPhkYNipXIkYGt/Va29M= Received: (qmail 108955 invoked by alias); 3 Apr 2018 20:54:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 108943 invoked by uid 89); 3 Apr 2018 20:54:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=qualified, jumping, doctype, UD:w3.org X-HELO: mail-ot0-f177.google.com Received: from mail-ot0-f177.google.com (HELO mail-ot0-f177.google.com) (74.125.82.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Apr 2018 20:54:14 +0000 Received: by mail-ot0-f177.google.com with SMTP id h26-v6so20934228otj.12 for ; Tue, 03 Apr 2018 13:54:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=RhIVERINOYfnK9jUkTSUhKjQeQ7CMobCfG0wQ8jHDtM=; b=bvOrRTpgzoLJfXF0T1szuYlQ3gt9WEIrh/E+d0IP6RUv99OY2b0hB6jCThdwzgdbfw AIhGZPIGUdfrPypi0SqeY8y5LFFmNvFxSaCtNs+vkAsexpK03JWLcHIPHgX6sqf+tpLh 6E4RxZRQa9YroOkZThr87lZ6Jzt60QjsVREpfvfkDH9fxGJDo7Q92G/PKGRh65FiUVR0 rCvUc9TMKzC04KKNq02i8u2B+zVCGAs/+18wHDQUfYnHFBVe60XRq/2Hbo5/vCsqjpan eQ0Ef+z+R7xTdVPYL9ibaCZSYDnnkNs4aSBkuUYUPhiYnkWDcBexfRrOCnPUOhqYiy5q nMJw== X-Gm-Message-State: ALQs6tDa1K6tvI5V1pYstqfho4lKAGD/tgfMoYNpWslUikAldkyPzbaz fJsR2WijV8H23oUY+xFQXMvogw== X-Google-Smtp-Source: AIpwx487Vp9AznEi+eCDqL3duse5ozHZbi9Tke0JAn+CxbDaiaW20ayDMA9ZCp0ILWOltld/wN6r3g== X-Received: by 2002:a9d:4d12:: with SMTP id n18-v6mr648428otf.170.1522788852511; Tue, 03 Apr 2018 13:54:12 -0700 (PDT) Received: from localhost.localdomain (174-16-100-37.hlrn.qwest.net. [174.16.100.37]) by smtp.gmail.com with ESMTPSA id c49-v6sm2333599ote.79.2018.04.03.13.54.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 13:54:11 -0700 (PDT) To: Gcc Patch List From: Martin Sebor Subject: [wwwdocs] document new options in gcc-8/changes.html Message-ID: Date: Tue, 3 Apr 2018 14:54:09 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-IsSubscribed: yes The attached changes add documentation of some of the options I worked on for GCC 8. The links to the GCC 8 manual don't work because there is no gcc-8 documentation directory. I have checked them by hand by substituting the GCC 7 directory. (I wonder: would it be possible to populate the GCC 8 documentation directory ahead of the release to make the checking easier?) I fixed all the errors for the document pointed out by the Markup Validator at https://validator.w3.org/check. Martin Index: changes.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-8/changes.html,v retrieving revision 1.50 diff -u -r1.50 changes.html --- changes.html 1 Apr 2018 22:19:57 -0000 1.50 +++ changes.html 3 Apr 2018 20:47:33 -0000 @@ -1,3 +1,4 @@ + @@ -9,7 +10,7 @@ --> -

GCC 8 Release Series
Changes, New Features, and Fixes

+

GCC 8 Release Series
Changes, New Features, and Fixes

This page is a "brief" summary of some of the huge number of improvements @@ -108,6 +109,20 @@ thus mitigate the attack vector that relies on jumping over a stack guard page as provided by the operating system. +

  • + GCC has been enhanced to detect more instances of meaningless or + mutually exclusive attribute specifications and hande such conflicts + more consistently. Mutually excclusive attribute specifications are + ignored with a warning regardless of whether they appear on the same + declaration or on distinct declarations of the same entitiy. For + example, because the noreturn attribute on the second + declaration below is mutually exclusive with the malloc + attribute on the first, it is ignored and a warning is issued. +
    +      void* __attribute__ ((malloc)) f (unsigned);
    +      void* __attribute__ ((noreturn)) f (unsigned);
    +
    +      warning: ignoring attribute 'noreturn' because it conflicts with attribute 'malloc' [-Wattributes]
  • @@ -163,10 +178,41 @@
    • New command-line options have been added for the C and C++ compilers:
        -
      • -Wmultistatement-macros warns about unsafe macros - expanding to multiple statements used as a body of a clause such - as if, else, while, - switch, or for.
      • +
      • -Wmultistatement-macros + warns about unsafe macros expanding to multiple statements used + as a body of a statement such as if, else, + while, switch, or for.
      • +
      • -Wstringop-truncation + warns for calls to bounded string manipulation functions such as + strncat, strncpy, and stpncpy + that might either truncate the copied string or leave the destination + unchanged. For example, the following call to strncat + is diagnosed because it appends just three of the four characters + from the source string.
        +	    void append (char *buf, size_t bufsize)
        +	    {
        +	        strncat (buf, ".txt", 3);
        +	    }
        +	    warning: 'strncat' output truncated copying 3 bytes from a string of length 4 [-Wstringop-truncation]
        + Similarly, in the following example, the call to strncpy + specifies the size of the destination buffer as the bound. If the + length of the source string is equal to or greater than this size + the result of the copy will not be NUL-terminated. Therefore, + the call is also diagnosed. To avoid the warning, specify + sizeof buf - 1 as the bound and set the last element of + the buffer to NUL.
        +	    void copy (const char *s)
        +	    {
        +	        char buf[80];
        +	        strncpy (buf, s, sizeof buf);
        +	        …
        +	    }
        +	    warning: 'strncpy' specified bound 80 equals destination size [-Wstringop-truncation]
        + The -Wstringop-truncation option is included in + -Wall.
        + Note that due to GCC bug 82944, defining strncat, strncpy, + or stpncpy as a macro in a system header as some + implementations do suppresses the warning.
    • -fno-strict-overflow is now mapped to @@ -174,11 +220,57 @@ is now undefined by default at all optimization levels. Using -fsanitize=signed-integer-overflow is now the preferred way to audit code, -Wstrict-overflow is deprecated.
    • +
    • The -Warray-bounds option has been + improved to detect more instances of out-of-bounds array indices and + pointer offsets. For example, negative or excessive indices into + flexible array members and string literals are detected.
    • +
    • The -Wrestrict option introduced in + GCC 7 has been enhanced to detect many more instances of overlapping + accesses to objects via restrict-qualified arguments to + standard memory and string manipulation functions such as + memcpy and strcpy. For example, + the strcpy call in the function below attempts to truncate + the string by replacing its initial characters with the last four. + However, because the function writes the terminating NUL into + a[4], the copies overlap and the call is diagnosed.
      +	void f (void)
      +	{
      +	    char a[] = "abcd1234";
      +	    strcpy (a, a + 4);
      +	    …
      +	}
      + The -Wrestrict option is included in -Wall. +
    • +
    • Several optimizer enhancements have enabled improvements to + the -Wformat-overflow and + -Wformat-truncation options. + The warnings detect more instances of buffer overflow and truncation + than in GCC 7 and are better at avoiding certain kinds of false + positives.

    C++

      -
    • +
    • New command-line options have been added for the C++ compiler: +
        +
      • -Wclass-memaccess warns + when objects of non-trivial class types are manipulated in potentially + unsafe ways by raw memory functions such as memcpy, or + realloc. The warning helps detect calls that bypass + user-defined constructors or copy-assignment operators, corrupt + virtual table pointers, data members of const-qualified + types or references, or member pointers. The warning also detects + calls that would bypass access controls to data members. For example, + a call such as: +
        +	memcpy (&std::cout, &std::cerr, sizeof std::cout);
        + results in +
        +	warning: 'void* memcpy(void*, const void*, long unsigned int)' writing to an object of type 'std::ostream' {aka 'class std::basic_ostream<char>'} with no trivial copy-assignment [-Wclass-memaccess]
        + The -Wclass-memaccess is included in -Wall. +
      • +
      +

    Fortran