From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0ED3B385DDE1; Tue, 11 Jun 2024 09:02:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0ED3B385DDE1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718096541; bh=8mF1UoI5g7ePF0dCkjQ0GZlvAmuOvnTSaCLe1j+JAXs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P3U7FbRrOMZ1nbHW2F6zj2w+0SV/1+Qvc84AV+EnpHic9LIVadLxWU98r8YyXlAUl KtkJyCbibhReBru8k9PqJuwU0RdPxfkPAp2Pi6/zI+4mtcrocJyi04U774IfeM6GFR eyi5Hmvckpv/p0r6zEsq0LujoJllRL6f5/Cau4O0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/114529] profiledbootstrap fails to build and m2 causes odr violations during build Date: Tue, 11 Jun 2024 09:02:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: gaius 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=3D114529 --- Comment #7 from GCC Commits --- The master branch has been updated by Gaius Mulley : https://gcc.gnu.org/g:a0004feb87efbe41fb1e9cd77f1c9af06e98ccb5 commit r15-1176-ga0004feb87efbe41fb1e9cd77f1c9af06e98ccb5 Author: Gaius Mulley Date: Tue Jun 11 10:01:12 2024 +0100 PR modula2/114529 Avoid ODR violations in bootstrap translated sources This patch changes the bootstrap tool mc to avoid redefining any data types and therefore preventing ODR violations. All exported opaque type usages are implemented as void *. Local opaque type usages (static functions containing opaque type parameters) use the full declaration. mc casts usages between void * and full opaque type as necessary. The --extended-opaque option in mc has been disabled, as this generated ODR violations. The extended-opaque option inlined all declarations in the translated implementation module. As this is no longer used there is now a .h file for each .def file and a .cc file for every .mod file. This results in more Makefile rules for the ppg tool in Make-maintainer= .in. gcc/m2/ChangeLog: PR modula2/114529 * Make-lang.in (MC_EXTENDED_OPAQUE): Assign to nothing. * Make-maintainer.in (mc-basetest): New rule. (mc-devel-basetest): New rule. (mc-clean): Remove mc. (m2/mc-boot-gen/$(SRC_PREFIX)decl.cc): Replace --extended-opaque with $(EXTENDED_OPAQUE). (PG-SRC): Move define before generic rules. (PGE-DEF): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)%.h): New rule. (m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SysExceptions.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)ldtoa.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)wrapc.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SYSTEM.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o): Ditto. (m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): Ditto. (m2/ppg$(exeext)): Ditto. (m2/gm2-ppg-boot/main.o): Ditto. (m2/gm2-auto): Ditto. (c-family/m2pp.o): Ditto. (BUILD-BOOT-PG-H): Correct macro definition. (m2/gm2-pg-boot/$(SRC_PREFIX)%.h): New rule. (m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)Output.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o): Ditto. (BUILD-BOOT-PGE-H): Correct macro definition. (m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Output.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o): Ditto. (m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto. (mc-basetest): Ditto. (mc-devel-basetest): Ditto. * gm2-compiler/M2Options.def (SetM2Dump): Add BOOLEAN return. * gm2-compiler/M2Quads.def (BuildAlignment): Add tokno paramete= r. (BuildBitLength): Ditto. * gm2-compiler/P3Build.bnf (ByteAlignment): Move tokpos assignm= ent to the start of the block. * gm2-compiler/PCBuild.bnf (ConstSetOrQualidentOrFunction): Dit= to. (SetOrDesignatorOrFunction): Ditto. * gm2-compiler/PHBuild.bnf (ConstSetOrQualidentOrFunction): Dit= to. (SetOrDesignatorOrFunction): Ditto. (ByteAlignment): Ditto. * gm2-libs/dtoa.def (dtoa): Change mode to INTEGER. * gm2-libs/ldtoa.def (ldtoa): Ditto. * mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_init): Correct parameter lis= t. (_M2_SYSTEM_fini): Ditto. * mc-boot-ch/Gdtoa.cc (dtoa_calcsign): Return bool. (dtoa_dtoa): Return void * and use bool in the fifth parameter. (_M2_dtoa_init): Correct parameter list. (_M2_dtoa_fini): Ditto. * mc-boot-ch/Gerrno.cc (_M2_errno_init): Ditto. (_M2_errno_fini): Ditto. * mc-boot-ch/Gldtoa.cc (dtoa_calcsign): Return bool. (ldtoa_ldtoa): Return void * and use bool in the fifth paramete= r. (_M2_ldtoa_init): Correct parameter list. (_M2_ldtoa_fini): Ditto. * mc-boot-ch/Glibc.c (tracedb_zresult): New function. (libc_read): Return size_t and use size_t in parameter three. (libc_write): Return size_t and use size_t in parameter three. (libc_printf): Add const to the format specifier. Change declaration of c to use const. (libc_snprintf): Add const to the format specifier. Change declaration of c to use const. (libc_malloc): Use size_t. (libc_memcpy): Ditto. * mc-boot/GASCII.cc: Regenerate. * mc-boot/GArgs.cc: Ditto. * mc-boot/GAssertion.cc: Ditto. * mc-boot/GBreak.cc: Ditto. * mc-boot/GCmdArgs.cc: Ditto. * mc-boot/GDebug.cc: Ditto. * mc-boot/GDynamicStrings.cc: Ditto. * mc-boot/GEnvironment.cc: Ditto. * mc-boot/GFIO.cc: Ditto. * mc-boot/GFormatStrings.cc: Ditto. * mc-boot/GFpuIO.cc: Ditto. * mc-boot/GIO.cc: Ditto. * mc-boot/GIndexing.cc: Ditto. * mc-boot/GM2Dependent.cc: Ditto. * mc-boot/GM2EXCEPTION.cc: Ditto. * mc-boot/GM2RTS.cc: Ditto. * mc-boot/GMemUtils.cc: Ditto. * mc-boot/GNumberIO.cc: Ditto. * mc-boot/GPushBackInput.cc: Ditto. * mc-boot/GRTExceptions.cc: Ditto. * mc-boot/GRTint.cc: Ditto. * mc-boot/GSArgs.cc: Ditto. * mc-boot/GSFIO.cc: Ditto. * mc-boot/GStdIO.cc: Ditto. * mc-boot/GStorage.cc: Ditto. * mc-boot/GStrCase.cc: Ditto. * mc-boot/GStrIO.cc: Ditto. * mc-boot/GStrLib.cc: Ditto. * mc-boot/GStringConvert.cc: Ditto. * mc-boot/GSysStorage.cc: Ditto. * mc-boot/GTimeString.cc: Ditto. * mc-boot/Galists.cc: Ditto. * mc-boot/Gdecl.cc: Ditto. * mc-boot/Gkeyc.cc: Ditto. * mc-boot/Glists.cc: Ditto. * mc-boot/GmcComment.cc: Ditto. * mc-boot/GmcComp.cc: Ditto. * mc-boot/GmcDebug.cc: Ditto. * mc-boot/GmcError.cc: Ditto. * mc-boot/GmcFileName.cc: Ditto. * mc-boot/GmcLexBuf.cc: Ditto. * mc-boot/GmcMetaError.cc: Ditto. * mc-boot/GmcOptions.cc: Ditto. * mc-boot/GmcPreprocess.cc: Ditto. * mc-boot/GmcPretty.cc: Ditto. * mc-boot/GmcPrintf.cc: Ditto. * mc-boot/GmcQuiet.cc: Ditto. * mc-boot/GmcReserved.cc: Ditto. * mc-boot/GmcSearch.cc: Ditto. * mc-boot/GmcStack.cc: Ditto. * mc-boot/GmcStream.cc: Ditto. * mc-boot/Gmcp1.cc: Ditto. * mc-boot/Gmcp2.cc: Ditto. * mc-boot/Gmcp3.cc: Ditto. * mc-boot/Gmcp4.cc: Ditto. * mc-boot/Gmcp5.cc: Ditto. * mc-boot/GnameKey.cc: Ditto. * mc-boot/GsymbolKey.cc: Ditto. * mc-boot/Gvarargs.cc: Ditto. * mc-boot/Gwlists.cc: Ditto. * mc-boot/Gdecl.h: Ditto. * mc-boot/Gldtoa.h: Ditto. * mc-boot/Glibc.h: Ditto. * mc/decl.def (putTypeOpaque): New procedure. (isTypeOpaque): New procedure function. * mc/decl.mod (debugOpaque): New constant. (nodeT): New enumeration field opaquecast. (node): New record field opaquecastF. (opaqueCastState): New record. (opaquecastT): New record. (typeT): New field isOpaque. (varT): New field opaqueState. (arrayT): Ditto. (varparamT): Ditto. (paramT): Ditto. (pointerT): Ditto. (recordfieldT): Ditto. (componentrefT): Ditto. (pointerrefT): Ditto. (arrayrefT): Ditto. (procedureT): Ditto. (proctypeT): Ditto. (makeType): Initialize field isOpaque. (makeTypeImp): Initialize field isOpaque. (putVar): Call initNodeOpaqueCastState. (putReturnType): Ditto. (makeProcType): Ditto. (putProcTypeReturn): Ditto. (makeVarParameter): Ditto. (makeNonVarParameter): Ditto. (makeFuncCall): Ditto. (putTypeOpaque): New procedure. (isTypeOpaque): New procedure function. (doMakeComponentRef): Call initNodeOpaqueCastState. (makePointerRef): Call initNodeOpaqueCastState. (doGetFuncType): Call initNodeOpaqueCastState. (doBinary): Add FALSE parameter to doExprCup. (doDeRefC): Rewrite. (doComponentRefC): Call flushOpaque. (doPointerRefC): Call flushOpaque. (doArrayRefC): Add const_cast for unbounded array. (doExprCup): Rewrite. (doTypeAliasC): Remove. (isDeclType): New procedure function. (doEnumerationC): New procedure function. (doParamTypeEmit): Ditto. (doParamTypeNameModifier): Ditto. (initOpaqueCastState): Ditto. (initNodeOpaqueCastState): Ditto. (setOpaqueCastState): Ditto. (setNodeOpaqueVoidStar): Ditto. (nodeUsesOpaque): Ditto. (getNodeOpaqueVoidStar): Ditto. (getOpaqueFlushNecessary): Ditto. (makeOpaqueCast): Ditto. (flushOpaque): Ditto. (castOpaque): Ditto. (isTypeOpaqueDefImp): Ditto. (isParamVoidStar): Ditto. (isRefVoidStar): Ditto. (isReturnVoidStar): Ditto. (isVarVoidStar): Ditto. (initNodeOpaqueState): Ditto. (assignNodeOpaqueCastState): Ditto. (assignNodeOpaqueCastFalse): Ditto. (dumpOpaqueState): Ditto. (doProcTypeC): Rewrite. (isDeclInImp): New procedure function. (doTypeNameModifier): Ditto. (doTypeC): Emit typedef if enum is declared in this module. (doCompletePartialProcType): Rewrite. (outputCompletePartialProcType): New procedure. (doOpaqueModifier): Ditto. (doVarC): Ditto. (doProcedureHeadingC): Add opaque modifier to return type if necessary. (doReturnC): Cast opaque type for return if necessary. (forceCastOpaque): New procedure. (forceReintCastOpaque): New procedure. (doUnConstCastUnbounded): New procedure. (doAssignmentC): Cast opaque for both des and expr if necessary. (doAdrExprC): Use static_cast for void * casting. (doFuncVarParam): New procedure. (doFuncParamC): Rewrite. (doAdrArgC): Rewrite. (getFunction): New procedure function. (stop): Rename to ... (localstop): ... this. (dupFunccall): Call assignNodeOpaqueCastState. (dbg): Rewrite. (addDone): Rewrite. (addDoneDef): Do not add opaque types to the doneQ when declare= d in the definition module. * mc/mc.flex (openSource): Return bool. (_M2_mcflex_init): Correct parameter list. (_M2_mcflex_fini): Ditto. * mc/mcComment.h (stdbool.h): Include. (mcComment_initComment): Change unsigned int to bool. * mc/mcOptions.mod (handleOption): Disable --extended-opaque and issue warning. * mc/mcp1.bnf (DefTypeDeclaration): Call putTypeOpaque. gcc/testsuite/ChangeLog: PR modula2/114529 * gm2/base-lang/pass/SYSTEM.def: New test. * gm2/base-lang/pass/base-lang-test.sh: New test. * gm2/base-lang/pass/globalproctype.def: New test. * gm2/base-lang/pass/globalproctype.mod: New test. * gm2/base-lang/pass/globalvar.def: New test. * gm2/base-lang/pass/globalvar.mod: New test. * gm2/base-lang/pass/globalvarassign.def: New test. * gm2/base-lang/pass/globalvarassign.mod: New test. * gm2/base-lang/pass/localproctype.def: New test. * gm2/base-lang/pass/localproctype.mod: New test. * gm2/base-lang/pass/localvar.def: New test. * gm2/base-lang/pass/localvar.mod: New test. * gm2/base-lang/pass/localvarassign.def: New test. * gm2/base-lang/pass/localvarassign.mod: New test. * gm2/base-lang/pass/opaquefield.def: New test. * gm2/base-lang/pass/opaquefield.mod: New test. * gm2/base-lang/pass/opaquenew.def: New test. * gm2/base-lang/pass/opaquenew.mod: New test. * gm2/base-lang/pass/opaqueparam.def: New test. * gm2/base-lang/pass/opaqueparam.mod: New test. * gm2/base-lang/pass/opaquestr.def: New test. * gm2/base-lang/pass/opaqueuse.def: New test. * gm2/base-lang/pass/opaqueuse.mod: New test. * gm2/base-lang/pass/opaqueusestr.def: New test. * gm2/base-lang/pass/opaqueusestr.mod: New test. * gm2/base-lang/pass/opaquevariant.def: New test. * gm2/base-lang/pass/opaquevariant.mod: New test. * gm2/base-lang/pass/opaquevarparam.def: New test. * gm2/base-lang/pass/opaquevarparam.mod: New test. * gm2/base-lang/pass/simplelist.def: New test. * gm2/base-lang/pass/simplelist.mod: New test. * gm2/base-lang/pass/simplelistiter.def: New test. * gm2/base-lang/pass/simplelistiter.mod: New test. * gm2/base-lang/pass/simpleopaque.def: New test. * gm2/base-lang/pass/simpleopaque.mod: New test. * gm2/base-lang/pass/straddress.def: New test. * gm2/base-lang/pass/straddress.mod: New test. * gm2/base-lang/pass/straddressexport.def: New test. * gm2/base-lang/pass/straddressexport.mod: New test. * gm2/base-lang/pass/unboundedarray.def: New test. * gm2/base-lang/pass/unboundedarray.mod: New test. Signed-off-by: Gaius Mulley =