From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 3EA053858401 for ; Mon, 5 Jun 2023 05:57:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3EA053858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b1b72dc2feso26392881fa.3 for ; Sun, 04 Jun 2023 22:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685944676; x=1688536676; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XaES1wWrI/6Qn6GRMLXS3svXVlwm7438GqlRTdDsPzA=; b=bwkI4VVeFyOc5Y0Mi0aaWEKhfZtgiGdgKFd9lI13OwXXak/V+ZIC5pkxu2O+1lUQIC 3w7GDxKibpRJa6uZ7SfKVvYaUsOrX1tuAaYbapCHSiIM1r6jL/ifmQjrLXd0+QAi2A60 kw8J2rLf04XgfxCUjWe5awfuUJDDPcrRei3hUG0rNDH333+f1Sz2yZrHYB6CH2ZDJuAY JxMCifFASsKa0w6nBttNVXaOog7Sr0lQFQB6uyJylOvY72QQOraVvSj04ZXBZJE2gab+ LS+avz6Ge2F1BmC+wdJiQ851i34FRDNhbodLZUScAoqL0amWBlT9Rs761wtkYIbj612u MopQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685944676; x=1688536676; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XaES1wWrI/6Qn6GRMLXS3svXVlwm7438GqlRTdDsPzA=; b=jugv0iior0VRoJO6Bsw6awaz34I/uDgo+L5ikXfI7gB3MaX/Q5nyPvVyKZU61SYYyh nxC/WcbYAqG5grhLYwH7bz/X22kYgpJqsSi3xRCLvtpsrG2ZtbPdPvgR4RbwejK92mSt zFv6U+tcUJpLVo0ExL+P4wW4l07pxMvzYgNVycKcfwJAc/Cry7N0D86tVpGSzZInUxwz B1dOk3+BnIVobDMJBdWmiAAPdeDdZVEQ4Dr9DFJWMzQIQUWFMXCghfQm4RCKQjSiCzQT jGaPDzj77n/EX9sopFgRg5zibvFAx6KebU7CEmMWPtTgNnWF9PVeJoGwA4Ylb4oi5Z1z XtSg== X-Gm-Message-State: AC+VfDy+T9+Evr1+4mnkFmUstiUsAQ8RzWji+M9CCmV7xoN6zBhHT7+m qOwvAWFCtEoQzg/ZhomeTWBWoj3O3d0I+uIdxGc= X-Google-Smtp-Source: ACHHUZ4repVMutozFO5ccY3cNjv+vw1PDjtQLOTX8A0PfYESW8p1DoVBroZ8zLpT/EBbEBwLGmNyTbYUqfdiblF7HfY= X-Received: by 2002:a2e:90c4:0:b0:2b1:c5e9:20b4 with SMTP id o4-20020a2e90c4000000b002b1c5e920b4mr1682872ljg.44.1685944675415; Sun, 04 Jun 2023 22:57:55 -0700 (PDT) MIME-Version: 1.0 References: <9ff071e705550749d0d05e4adabd0ba0f07e8f45.camel@microchip.com> In-Reply-To: <9ff071e705550749d0d05e4adabd0ba0f07e8f45.camel@microchip.com> From: Richard Biener Date: Mon, 5 Jun 2023 07:57:41 +0200 Message-ID: Subject: Re: [PATCH, PR110086] avr: Fix ICE on optimize attribute To: SenthilKumar.Selvaraj@microchip.com Cc: gcc-patches@gcc.gnu.org, chertykov@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Jun 2, 2023 at 11:54=E2=80=AFAM SenthilKumar.Selvaraj--- via Gcc-patches wrote: > > Hi, > > This patch fixes an ICE when an optimize attribute changes the prevailing > optimization level. > > I found https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105069 describing = the > same ICE for the sh target, where the fix was to enable save/restore of > target specific options modified via TARGET_OPTIMIZATION_TABLE hook. > > For the AVR target, mgas-isr-prologues and -mmain-is-OS_task are those > target specific options. As they enable generation of more optimal code, > this patch adds the Optimization option property to those option records, > and that fixes the ICE. > > Regression run shows no regressions, and >100 new PASSes. > Ok to commit to master? LGTM Richard. > Regards > Senthil > > > PR 110086 > > gcc/ChangeLog: > > * config/avr/avr.opt (mgas-isr-prologues, mmain-is-OS_task): > Add Optimization option property. > > gcc/testsuite/ChangeLog: > > * gcc.target/avr/pr110086.c: New test. > > diff --git gcc/config/avr/avr.opt gcc/config/avr/avr.opt > index f62d746..5a0b465 100644 > --- gcc/config/avr/avr.opt > +++ gcc/config/avr/avr.opt > @@ -27,7 +27,7 @@ Target RejectNegative Joined Var(avr_mmcu) MissingArgEr= ror(missing device or arc > -mmcu=3DMCU Select the target MCU. > > mgas-isr-prologues > -Target Var(avr_gasisr_prologues) UInteger Init(0) > +Target Var(avr_gasisr_prologues) UInteger Init(0) Optimization > Allow usage of __gcc_isr pseudo instructions in ISR prologues and epilog= ues. > > mn-flash=3D > @@ -65,7 +65,7 @@ Target Joined RejectNegative UInteger Var(avr_branch_co= st) Init(0) > Set the branch costs for conditional branch instructions. Reasonable va= lues are small, non-negative integers. The default > branch cost is 0. > > mmain-is-OS_task > -Target Mask(MAIN_IS_OS_TASK) > +Target Mask(MAIN_IS_OS_TASK) Optimization > Treat main as if it had attribute OS_task. > > morder1 > diff --git gcc/testsuite/gcc.target/avr/pr110086.c gcc/testsuite/gcc.targ= et/avr/pr110086.c > new file mode 100644 > index 0000000..6b97620 > --- /dev/null > +++ gcc/testsuite/gcc.target/avr/pr110086.c > @@ -0,0 +1,5 @@ > +/* { dg-do compile } */ > +/* { dg-options "-Os" } */ > + > +void __attribute__((optimize("O0"))) foo(void) { > +}