From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 306013858D35; Thu, 9 Nov 2023 18:04:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 306013858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699553081; bh=PA+pcJfQ+S00cDDkANQSQIc1NaRM6csZL9nHo5UdN98=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tcwCFIjx+awZ4q2O3MnKaZQhe1UV4gaMQDBTAWWOT+evFbuAHF9K1u3b30LodAYGg 2QusiDGmIZGerGyzrdAZYx1TILgneXc91UvwwpNQPLzrRfQs6D+VmMUSbCu1R1PW6S hrelckLzwa6gLb2JyKxFrB939yx1qhiFkc1hbbOM= From: "danglin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/112415] [14 regression] Python 3.11 miscompiled on HPPA with new RTL fold mem offset pass, since r14-4664-g04c9cf5c786b94 Date: Thu, 09 Nov 2023 18:04:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: danglin 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: 14.0 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=3D112415 --- Comment #29 from John David Anglin --- The miscompilation is in compiler_visit_expr: (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/dave/debian/python3.11/python3.11-3.11.6/build-static/Programs/_freez= e_module importlib._bootstrap ../Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h warning: Unable to find libthread_db matching inferior's thread library, th= read debugging will not be available. Breakpoint 2, compiler_jump_if (c=3D0xf8f02508, e=3D0x5763f8, next=3D0xfaea= a908, cond=3D0) at ../Python/compile.c:2898 2898 { (gdb) watch *0xfaea51b8 Watchpoint 3: *0xfaea51b8 (gdb) c Continuing. Watchpoint 3: *0xfaea51b8 Old value =3D -85046408 New value =3D 43 0x0019c688 in compiler_visit_expr (e=3D0x576308, c=3D0xf8f02508) at ../Python/compile.c:5968 5968 SET_LOC(c, e); (gdb) bt #0 0x0019c688 in compiler_visit_expr (e=3D0x576308, c=3D0xf8f02508) at ../Python/compile.c:5968 #1 compiler_call_helper (c=3D0xf8f02508, n=3D0, args=3D, keywords=3D0x0) at ../Python/compile.c:5138 #2 0x0019ec70 in compiler_visit_expr (e=3D, c=3D0xf8f02508) at ../Python/compile.c:5969 #3 compiler_jump_if (c=3D0xf8f02508, e=3D, next=3D0x0, cond=3D) at ../Python/compile.c:2988 #4 0x001a0770 in compiler_if (s=3D0x0, c=3D0x5763c0) at ../Python/compile.= c:3090 #5 compiler_visit_stmt (c=3D0x5763c0, s=3D0x0) at ../Python/compile.c:4118 #6 0x001a1378 in compiler_for (s=3D0x0, c=3D0x5763c0) at ../Python/compile= .c:3124 #7 compiler_visit_stmt (c=3D0x5763c0, s=3D0x0) at ../Python/compile.c:4114 #8 0x001a3170 in compiler_function (c=3D0x2, s=3D, is_async=3D) at ../Python/compile.c:2670 #9 0x001a3438 in compiler_body (c=3D0x0, stmts=3D0x5763c0) at ../Python/compile.c:2180 #10 0x001a5cdc in compiler_mod (mod=3D0x0, c=3D0xf8f02528) at ../Python/compile.c:2197 #11 _PyAST_Compile (mod=3D0x0, filename=3D0xf8f02528, flags=3D, optimize=3D, arena=3D) at ../Python/compi= le.c:581 #12 0x001dea00 in Py_CompileStringObject (optimize=3D0, flags=3D0x5763c0, s= tart=3D0, filename=3D0x2, str=3D0x0) at ../Python/pythonrun.c:1799 #13 Py_CompileStringExFlags (str=3D0x0, filename_str=3D, sta= rt=3D0, --Type for more, q to quit, c to continue without paging-- flags=3D0x5763c0, optimize=3D) at ../Python/pythonrun.c:= 1812 #14 0x000167a4 in compile_and_marshal (text=3D0x0, name=3D0x2 ) at ../Programs/_freeze_module.c:125 #15 main (argc=3D0, argv=3D) at ../Programs/_freeze_module.c= :230 (gdb) diass $pc-16,$pc+16 Undefined command: "diass". Try "help". (gdb) disass $pc-16,$pc+16 Dump of assembler code from 0x19c678 to 0x19c698: 0x0019c678 : ldw 14(r25),ret1 0x0019c67c : ldw 18(r25),r31 0x0019c680 : ldw 1c(r25),ret0 0x0019c684 : stw r23,0(r22) =3D> 0x0019c688 : stw ret1,0(r21) 0x0019c68c : stw r31,0(r20) 0x0019c690 : b,l 0x198d58 ,rp 0x0019c694 : stw ret0,0(r19) End of assembler dump. The code at 0x0019c688 clobbers the value at c->u->u_ste: (gdb) p/x $r21 $35 =3D 0xfaea51b8 (gdb) p/x *c $36 =3D {c_filename =3D 0xfaed9480, c_st =3D 0xfaeafd10, c_future =3D 0xfae= f7030, c_flags =3D 0xf8f02544, c_optimize =3D 0x0, c_interactive =3D 0x0, c_nestlevel =3D 0x2, c_const_cache =3D 0xfae81280, u =3D 0xfaea51b8, c_stack =3D 0xfae57a88, c_arena =3D 0xfaec0c90} (gdb) p/x *c->u $37 =3D {u_ste =3D 0x2b, u_name =3D 0xfae7ff80, u_qualname =3D 0xfae7ff80, u_scope_type =3D 0x2, u_consts =3D 0xfaeaa7f8, u_names =3D 0xfaeaa7d0, u_varnames =3D 0xfaeaa780, u_cellvars =3D 0xfaeaa7a8, u_freevars =3D 0xfa= eaa758, u_private =3D 0x0, u_argcount =3D 0x2, u_posonlyargcount =3D 0x0, u_kwonlyargcount =3D 0x0, u_blocks =3D 0xfaeaa908, u_curblock =3D 0xfaeaa= 868, u_nfblocks =3D 0x1, u_fblock =3D {{fb_type =3D 0x1, fb_block =3D 0xfaeaa8= 40, fb_exit =3D 0xfaeaa8b8, fb_datum =3D 0x0}, {fb_type =3D 0x0, fb_block= =3D 0x0, fb_exit =3D 0x0, fb_datum =3D 0x0} }, u_firstlineno =3D 0x28, u_lineno =3D 0x2b, u_col_offset =3D 0xb, u_end_lineno =3D 0x2b, u_end_col_offset =3D 0x20, u_need_new_implicit_block =3D 0x0} (gdb) p/x $r23 $38 =3D 0x2b #define SET_LOC(c, x) \ (c)->u->u_lineno =3D (x)->lineno; \ (c)->u->u_col_offset =3D (x)->col_offset; \ (c)->u->u_end_lineno =3D (x)->end_lineno; \ (c)->u->u_end_col_offset =3D (x)->end_col_offset; (gdb) p/x *e $40 =3D {kind =3D 0x18, v =3D {BoolOp =3D {op =3D 0xfaeb8b60, values =3D 0x= 1}, NamedExpr =3D {target =3D 0xfaeb8b60, value =3D 0x1}, BinOp =3D { left =3D 0xfaeb8b60, op =3D 0x1, right =3D 0x0}, UnaryOp =3D {op =3D = 0xfaeb8b60, operand =3D 0x1}, Lambda =3D {args =3D 0xfaeb8b60, body =3D 0x1}, IfE= xp =3D { test =3D 0xfaeb8b60, body =3D 0x1, orelse =3D 0x0}, Dict =3D {keys = =3D 0xfaeb8b60, values =3D 0x1}, Set =3D {elts =3D 0xfaeb8b60}, ListComp =3D {elt =3D= 0xfaeb8b60, generators =3D 0x1}, SetComp =3D {elt =3D 0xfaeb8b60, generators =3D = 0x1}, DictComp =3D {key =3D 0xfaeb8b60, value =3D 0x1, generators =3D 0x0}, GeneratorExp =3D {elt =3D 0xfaeb8b60, generators =3D 0x1}, Await =3D { value =3D 0xfaeb8b60}, Yield =3D {value =3D 0xfaeb8b60}, YieldFrom = =3D { value =3D 0xfaeb8b60}, Compare =3D {left =3D 0xfaeb8b60, ops =3D 0x1, comparators =3D 0x0}, Call =3D {func =3D 0xfaeb8b60, args =3D 0x1, keywords =3D 0x0}, FormattedValue =3D {value =3D 0xfaeb8b60, conversi= on =3D 0x1, format_spec =3D 0x0}, JoinedStr =3D {values =3D 0xfaeb8b60}, Constant= =3D { value =3D 0xfaeb8b60, kind =3D 0x1}, Attribute =3D {value =3D 0xfaeb8= b60, attr =3D 0x1, ctx =3D 0x0}, Subscript =3D {value =3D 0xfaeb8b60, slic= e =3D 0x1, ctx =3D 0x0}, Starred =3D {value =3D 0xfaeb8b60, ctx =3D 0x1}, Name = =3D { id =3D 0xfaeb8b60, ctx =3D 0x1}, List =3D {elts =3D 0xfaeb8b60, ctx = =3D 0x1}, Tuple =3D {elts =3D 0xfaeb8b60, ctx =3D 0x1}, Slice =3D {lower =3D 0xfa= eb8b60, upper =3D 0x1, step =3D 0x0}}, lineno =3D 0x2b, col_offset =3D 0x18, end_lineno =3D 0x2b, end_col_offset =3D 0x1f} Seems like an offset issue.=