From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E91653857BB5; Thu, 11 Aug 2022 08:47:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E91653857BB5 From: "jankowski938 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106582] New: Wrong code generation resulting in HardFault Date: Thu, 11 Aug 2022 08:47:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jankowski938 at gmail dot com 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 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: Thu, 11 Aug 2022 08:47:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106582 Bug ID: 106582 Summary: Wrong code generation resulting in HardFault Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jankowski938 at gmail dot com Target Milestone: --- It makes -Ofast, -O3 unusable. 1154 pQueryChunk->pSrcDriver =3D pParser->pSourceDriver; 080157f4: ldr.w r3, [r9, #20] 080157f8: str.w r3, [r11, #12] 080157fc: b.n 0x801556e 080157fe: movs r3, #0 08015800: ldr.w r2, [r9, #20] 08015804: str r2, [r3, #12] 08015806: udf #255 ; 0xff <---------- obviously wrong if (pQueryChunk && ioIsValid(pRawChunk)) { pQueryChunk->pSrcDriver =3D pRawChunk->pSrcDriver; }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 else if (pParser) { pQueryChunk->pSrcDriver =3D pParser->pSourceDriver; } GNU C11 (GNU Tools for STM32 10.3-2021.10.20211105-1100) version 10.3.1 20210824 (release) (arm-none-eabi) compiled by GNU C version 7.3-win32 20180312, GMP version 6.1.0, MP= FR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=3D100 --param ggc-min-heapsize=3D131= 072 COLLECT_GCC_OPTIONS=3D'-mcpu=3Dcortex-m4' '-std=3Dgnu11' '-g3' '-D' '_GNU_S= OURCE=3D1' '-D' 'USE_HAL_DRIVER' '-D' '_DEBUG=3D1' '-D' 'DEBUG_RUN_WITHOUT_CHECKS=3D1'= '-D' 'DEBUGFILEWRITE=3D0' '-D' 'DEBUG=3D0' '-D' 'SLOWSPIDEBUG=3D0' '-D' 'USE_FUL= L_ASSERT' '-D' '__USE_SIMPLE_SWO=3D0' '-D' 'USE_SWOTRACE=3D1' '-D' 'AMD64' '-D' 'HSE_VALUE=3D16000000UL' '-D' 'USE_FULL_LL_DRIVER=3D0' '-D' 'BOOTLOADER_VER= SION=3D1' '-D' 'ALLOW_SOFTWARE_BKPTS=3D1' '-D' 'ARM_MATH_CM4' '-D' 'FORCE_CUBE_USB' '= -D' 'USE_EMBEDDED_PHY=3D1' '-D' 'USE_USB_OTG_FS=3D1' '-D' 'BITMAP_LCD_ALLOWED= =3D0' '-D' 'LCDGUI_ALLOWED=3D0' '-D' 'LCD_ALLOWED=3D0' '-D' 'GPS_ALLOWED=3D0' '-D' 'ST= M32L4S9xx' '-D' 'STM32L' '-D' 'INCLUDE_SLEEP_FUNCTIONS=3D1' '-D' 'COMPILE_FOR_EWB=3D1'= '-D' 'COMPILE_USE_PL4S=3D1' '-c' '-Ofast' '-ffunction-sections' '-fdata-sections' '-Wall' '-v' '-fstack-usage' '-MMD' '-MP' '-MF' '-MT' '-specs=3Dnano.specs' '-mfpu=3Dfpv4-sp-d16' '-mfloat-abi=3Dhard' '-mthumb' '-o' '-mlibarch=3Darm= v7e-m+fp' '-march=3Darmv7e-m+fp' -march=3Darmv7e-m -mfloat-abi=3Dhard -mfpu=3Dfpv4-sp-d16 -meabi=3D5 -o Libraries/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.o C:\Users\Piotr\AppData\Local\Temp\ccHP5ygN.s GNU assembler version 2.36.1 (arm-none-eabi) using BFD version (GNU Tools f= or STM32 10.3-2021.10.20211105-1100) 2.36.1.20210621=