From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 49AC93858D28; Thu, 19 Jan 2023 06:03:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49AC93858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674108233; bh=Tab9i4hEV9O55tLChlfK1y5T3adW2uBGiNBGWbEygss=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XS90RpXBnKFsczQg8T7wtGmHOykJKMy6jnNhIXPg59P6HMsM2V/AD42DwybU3llWk qDTsZSyKMrNhd5HXmgVZeN2xx2zCjHviNI5C2keZeiejUQskMiBf9uUudFb8mas3OK iJQ2W/dFbg4ZWTimDR10kXYpw1nI0F5lsm4r7bWk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108448] GCC Elides Assignment to Pointer and memcpy Date: Thu, 19 Jan 2023 06:03:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: WAITING 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: Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108448 --- Comment #7 from Andrew Pinski --- I do notice some aliasing violations with y_map_index and y_strucon_handleErrorHelper y_vec* stack; ... y_map_existsStringKey_v(d->contexts, ("com.yzena.yc.error_handler"), &stack)) ... y_map_existsStringKey_v takes a void* and passes it to: ret =3D (y_map_index(m, &str, # 896 "yc/src/container/map.c" 3 4 ((void *)0) # 896 "yc/src/container/map.c" , val_ptr) !=3D ((y_usize) -1)); While y_map_index's last argument is y_uchar** and you do the store as y_uc= har* inside y_map_index: *val_ptr =3D ((m)->map[(arrayIdx)] + (itemIdx) * (m->esize)); ------ CUT ----- I suspect cmake didn't add -fno-strict-aliasing really. Can you try: *(void**)val_ptr =3D ((m)->map[(arrayIdx)] + (itemIdx) * (m->esize)); Note GCC extends aliasing here where "void*" is treated similarly as a character type with respect to aliasing.=