{"id":808226,"url":"http://patchwork.ozlabs.org/api/patches/808226/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170831121754.GH17069@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170831121754.GH17069@redhat.com>","list_archive_url":null,"date":"2017-08-31T12:17:54","name":"C++ PATCH to fix ICE with -Wbool-operation (PR c++/82040)","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"01eb095828a5a45794bce241af366374e2a6bc76","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/people/14370/?format=json","name":"Marek Polacek","email":"polacek@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170831121754.GH17069@redhat.com/mbox/","series":[{"id":815,"url":"http://patchwork.ozlabs.org/api/series/815/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=815","date":"2017-08-31T12:17:54","name":"C++ PATCH to fix ICE with -Wbool-operation (PR c++/82040)","version":1,"mbox":"http://patchwork.ozlabs.org/series/815/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808226/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808226/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461205-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461205-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"ZVXxeEAE\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=polacek@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjhHB5j3Fz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 22:18:29 +1000 (AEST)","(qmail 78269 invoked by alias); 31 Aug 2017 12:18:20 -0000","(qmail 78260 invoked by uid 89); 31 Aug 2017 12:18:19 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tThu, 31 Aug 2017 12:18:09 +0000","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.14])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 09233C047B8D\tfor\n\t<gcc-patches@gcc.gnu.org>; Thu, 31 Aug 2017 12:18:08 +0000 (UTC)","from redhat.com (ovpn-204-79.brq.redhat.com [10.40.204.79])\tby\n\tsmtp.corp.redhat.com (Postfix) with ESMTPS id 68099B32C7;\n\tThu, 31 Aug 2017 12:18:06 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=ZW19FOujfH8eprxByJHX9yrCSS2NCbuJHgQoCH3L6/cA7gjX6cy3C\n\th6d0yoevBTzszDYA72DUczAMk5IV5tb5NuLFUtmxyz3lj9LI/hPhYSJEQ30+ueSG\n\tFWzSCTPDEEOrQp+49iU3OQVkNTcrm/octvSYYgltHDEvTcemcystMQ=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=EJfNOHEAbs7PedBqEiuQ41J9jJo=; b=ZVXxeEAEDLC+cO3bLMm/\n\tAhjfwwD/heSAETGcmzYt8demySjM3nriUNDhME1K8vG+/kBWnvdBY4JA+zx23wUK\n\tynZ9LoCxo7OJdHAux4hli3d315TibeCgz1rPuDhBjRhTSO+L88i0Jcaf4G2xAApG\n\tD3n6/6hNyfuAyYSi/pqAcw8=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=ensued","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 09233C047B8D","Date":"Thu, 31 Aug 2017 14:17:54 +0200","From":"Marek Polacek <polacek@redhat.com>","To":"GCC Patches <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>","Subject":"C++ PATCH to fix ICE with -Wbool-operation (PR c++/82040)","Message-ID":"<20170831121754.GH17069@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.8.3 (2017-05-23)"},"content":"Here we got into re-entering the error reporting routines because the\nwarning_at call wasn't guarded with \"complain\", and crash ensued.\n\nBootstrapped/regtested on x86_64-linux, ok for trunk/7?\n\n2017-08-31  Marek Polacek  <polacek@redhat.com>\n\n\tPR c++/82040\n\t* typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.\n\n\t* g++.dg/warn/Wbool-operation-1.C: New test.\n\n\n\tMarek","diff":"diff --git gcc/cp/typeck.c gcc/cp/typeck.c\nindex 171c2dfb57c..b303ceaede1 100644\n--- gcc/cp/typeck.c\n+++ gcc/cp/typeck.c\n@@ -5982,6 +5982,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,\n \t{\n \t  /* Warn if the expression has boolean value.  */\n \t  if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE\n+\t      && (complain & tf_error)\n \t      && warning_at (location, OPT_Wbool_operation,\n \t\t\t     \"%<~%> on an expression of type bool\"))\n \t    inform (location, \"did you mean to use logical not (%<!%>)?\");\ndiff --git gcc/testsuite/g++.dg/warn/Wbool-operation-1.C gcc/testsuite/g++.dg/warn/Wbool-operation-1.C\nindex e69de29bb2d..4512b858287 100644\n--- gcc/testsuite/g++.dg/warn/Wbool-operation-1.C\n+++ gcc/testsuite/g++.dg/warn/Wbool-operation-1.C\n@@ -0,0 +1,11 @@\n+// PR c++/82040\n+// { dg-do compile { target c++11 } }\n+// { dg-options \"-Wbool-operation\" }\n+\n+template <class c>\n+decltype (~c{})\n+call ()\n+{\n+  return ~false; // { dg-warning \"on an expression of type bool\" }\n+}\n+template int call<bool>();\n","prefixes":[]}