From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DD0A93982C28; Tue, 29 Jun 2021 11:53:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD0A93982C28 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/101257] New: [11/12 Regression] Maybe wrong code since IPA mod ref was introduced Date: Tue, 29 Jun 2021 11:53:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2021 11:54:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101257 Bug ID: 101257 Summary: [11/12 Regression] Maybe wrong code since IPA mod ref was introduced Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- It's likely caused by a violation of the strict aliasing rules, but I can't verify that: $ wget http://loop-aes.sourceforge.net/aespipe/aespipe-v2.4f.tar.bz2 $ cd aespipe-v2.4f/ $ export CFLAGS=3D"-O2 -flto -flto-partition=3Done" && ./configure && make = tests ... ./aespipe -v -p 3 -e AES128 -K ./gpgkey2.asc -G test-dir1 test-file1 3test-file2 echo "f9825b79873f5c439ae9371c1a929a6c test-file1" >test-file5 make[2]: Leaving directory '/tmp/aespipe-v2.4f' cmp test-file2 test-file5 test-file2 test-file5 differ: byte 1, line 1 make[1]: *** [Makefile:120: test-part2] Error 1 make[1]: Leaving directory '/tmp/aespipe-v2.4f' make: *** [Makefile:87: tests] Error 2 Adding -fno-strict-aliasing fixes that. And the following dbg counter shows that: $ gcc -o aespipe aespipe.o aes.o md5.o sha512.o rmd160.o -fdbg-cnt=3Dipa_mod_ref:385-385 -flto-partition=3Done -fdump-tree-optimized-lineno=3Dbad -fdump-ipa-modref-details && make tests optimized dump diff is then: ;; Function compute_sector_iv (compute_sector_iv, funcdef_no=3D0, decl_uid= =3D4504, cgraph_uid=3D12, symbol_order=3D57) ... [./aespipe.c:775:20] _13 =3D MEM[(u_int64_t *)bfp_22 + 16B]; [./aespipe.c:775:26] _14 =3D MEM[(u_int64_t *)bfp_22]; [./aespipe.c:775:20] _15 =3D _13 ^ _14; [./aespipe.c:775:20] MEM[(u_int64_t *)bfp_22 + 16B] =3D _15; [./aespipe.c:776:20] _16 =3D MEM[(u_int64_t *)bfp_22 + 24B]; - [./aespipe.c:776:26] _17 =3D MEM[(u_int64_t *)bfp_22 + 8B]; - [./aespipe.c:776:20] _18 =3D _16 ^ _17; + [./aespipe.c:776:20] _18 =3D _12 ^ _16; [./aespipe.c:776:20] MEM[(u_int64_t *)bfp_22 + 24B] =3D _18; So one load is optimized out 769 do { 770 bfp[0] ^=3D dip[0]; 771 bfp[1] ^=3D dip[1]; 772 aes_encrypt(acpa[0], (unsigned char *)bfp, (unsigned ch= ar *)bfp); 773 dip =3D bfp; 774 bfp +=3D 2; 775 bfp[0] ^=3D dip[0]; 776 bfp[1] ^=3D dip[1]; 777 aes_encrypt(acpa[0], (unsigned char *)bfp, (unsigned ch= ar *)bfp); 778 dip =3D bfp; 779 bfp +=3D 2; 780 } while(--x >=3D 0); 781 size -=3D 512; @Honza: Can you please take a look?=