public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/108695] [13 Regression] Wrong code since r13-5215-gb1f30bf42d8d47 for dd_rescue package Date: Wed, 08 Feb 2023 11:16:42 +0000 [thread overview] Message-ID: <bug-108695-4-bDccSxXSqP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108695-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108695 --- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > I am 99% sure there is aliasing violations in this code too: > #if _MSC_VER > #define GETU32(p) SWAP(*((u32 *)(p))) > #define PUTU32(ct, st) \ > { \ > *((u32 *)(ct)) = SWAP((st)); \ > } Yes, I'm also suspecting this code and I can verify that using optimize("O0") for rijndaelEncrypt fixes the issue. The thing below is cast from 'const u8 *' and I thought it's valid to case to 'u32 *' and then access it. Can you explain to me how exactly the violation happens? > #else /* _MSC_VER */ > # if __BYTE_ORDER == __BIG_ENDIAN > #define GETU32(p) *((u32*)(p)) > #define PUTU32(ct, st) *((u32*)(ct)) = (st) > #else /* BIG_ENDIAN */ > #if 0 //def HAVE_LINUX_SWAB_H > #define GETU32(p) __swab32(*((u32*)(p))) > #define PUTU32(ct, st) *((u32*)(ct)) = __swab32((st)) > #else /* __GNUC__ */ > #include <netinet/in.h> > #define GETU32(p) ntohl(*((u32*)(p))) > #define PUTU32(ct, st) *((u32*)(ct)) = htonl((st)) > #endif /* __GNUC__ */ > #endif /* BIG_ENDIAN */ > #endif /*_MSC_VER */ > This part below is guarded with '#if 0'.. > #if 0 > #define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ > ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) > #define PUTU32(ct, st) \ > { \ > (ct)[0] = (u8)((st) >> 24); \ > (ct)[1] = (u8)((st) >> 16); \ > (ct)[2] = (u8)((st) >> 8); \ > (ct)[3] = (u8)(st); \ > } > #endif > > A few other places too ...
next prev parent reply other threads:[~2023-02-08 11:16 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-07 12:56 [Bug ipa/108695] New: " marxin at gcc dot gnu.org 2023-02-07 12:56 ` [Bug ipa/108695] " marxin at gcc dot gnu.org 2023-02-07 15:17 ` pinskia at gcc dot gnu.org 2023-02-07 15:18 ` pinskia at gcc dot gnu.org 2023-02-08 7:24 ` marxin at gcc dot gnu.org 2023-02-08 7:25 ` marxin at gcc dot gnu.org 2023-02-08 7:38 ` pinskia at gcc dot gnu.org 2023-02-08 11:16 ` marxin at gcc dot gnu.org [this message] 2023-02-08 11:29 ` jakub at gcc dot gnu.org 2023-02-08 14:50 ` marxin at gcc dot gnu.org 2023-02-08 15:09 ` marxin at gcc dot gnu.org 2023-02-08 15:18 ` marxin at gcc dot gnu.org 2023-02-08 15:24 ` sam at gentoo dot org 2023-02-08 15:25 ` marxin at gcc dot gnu.org 2023-02-08 15:27 ` marxin at gcc dot gnu.org 2023-02-08 15:28 ` jakub at gcc dot gnu.org 2023-02-08 15:52 ` marxin at gcc dot gnu.org 2023-02-23 21:04 ` kurt at garloff dot de 2023-02-23 22:04 ` kurt at garloff dot de 2023-02-24 12:24 ` kurt at garloff dot de
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-108695-4-bDccSxXSqP@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: linkBe 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).