public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/97276] A whole if-block is ignored by avr-gcc 9.3.0
Date: Thu, 23 Feb 2023 15:44:07 +0000	[thread overview]
Message-ID: <bug-97276-4-RQclkzX7ME@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97276-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 54518
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54518&action=edit
pwn-i.c pre-compiled test case

Ok, I found it and attached a cleaned-up version.

IIUC correctly, the relevant options you are using to compile are: -O1
-mmcu=atxmega32a4 -g -ggdb -std=gnu99

With these options (and with -fverbose-asm to easier navigate in asm) I could
not reproduce the problem with avr-gcc v8.5.  The respective part of .s reads
(I dropped -g for legibility, but with -g it's same):

 ;  pwm-i.c:287:         if (last_brightness < 181 && j >= 181)
        ldi r30,lo8(-76)         ; ,     ;  320 [c=4 l=1]  movqi_insn/1
        cp r30,r11               ; , last_brightness     ;  193 [c=4 l=1] 
cmpqi3/1
        brsh .+2         ;       ;  194 [c=16 l=2]  branch
        rjmp .L16        ; 
 ;  pwm-i.c:287:         if (last_brightness < 181 && j >= 181)
        cpi r22,lo8(-75)         ;  iftmp.3_5,   ;  196 [c=4 l=1]  cmpqi3/2
        brsh .+2         ;       ;  197 [c=16 l=2]  branch
        rjmp .L16        ; 
 ;  pwm-i.c:289:             slot->top = 0xfe00;
        st X+,r8         ;  tmp226       ;  200 [c=4 l=3]  *movhi/3
        st X,r9  ;  tmp226
        sbiw r26,1
 ;  pwm-i.c:290:             slot->mask = ~mask;
        movw r30,r24     ;  tmp200, mask         ;  321 [c=4 l=1]  *movhi/0
        com r30  ;  tmp200       ;  201 [c=8 l=2]  one_cmplhi2
        com r31  ;  tmp200
 ;  pwm-i.c:290:             slot->mask = ~mask;
        adiw r26,2       ;  slot_172->mask       ;  202 [c=4 l=4]  *movhi/3
        st X+,r30        ;  tmp200
        st X,r31         ;  tmp200
        sbiw r26,2+1     ;  slot_172->mask
 ;  pwm-i.c:291:             ++slot;
        adiw r26,4       ;  slot,        ;  203 [c=4 l=1]  addhi3_clobber/0

  parent reply	other threads:[~2023-02-23 15:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03  0:33 [Bug c/97276] New: " tre at gmx dot de
2020-10-03  0:34 ` [Bug c/97276] " tre at gmx dot de
2023-02-23 13:31 ` [Bug target/97276] " gjl at gcc dot gnu.org
2023-02-23 13:56 ` tre at gmx dot de
2023-02-23 15:44 ` gjl at gcc dot gnu.org [this message]
2023-02-23 16:02 ` gjl at gcc dot gnu.org
2024-02-20 15:27 ` gjl at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97276-4-RQclkzX7ME@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).