When building mipsel simulator, on GDB 12.1, build fails with: In file included from support.c:25: /<<PKGBUILDDIR>>/sim/mips/mips.igen: In function ‘do_dmfc1b’: /<<PKGBUILDDIR>>/sim/mips/sim-main.h:41:25: error: conversion from ‘long long unsigned int’ to ‘unsigned_word’ {aka ‘unsigned int’} changes value from ‘16045693110240459472’ to ‘3134241488’ [-Werror=overflow] 41 | #define SET64HI(t) (((uword64)(t))<<32) | ^ /<<PKGBUILDDIR>>/sim/mips/mips.igen:1453:15: note: in expansion of macro ‘SET64HI’ 1453 | GPR[rt] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; | ^~~~~~~ Full log: https://buildd.debian.org/status/fetch.php?pkg=gdb&arch=mipsel&ver=12.1-1&stamp=1655916813&raw=0 Build was fine on 11.2 release.
pretty sure the warning was in there in older versions, the diff with gdb-12 is that we enabled -Werror (since it was building cleanly for the few targets i checked)
the code in question is: :function:::void:do_dmfc1b:int rt, int fs *mipsIV: *mipsV: *mips64: *mips64r2: *mips64r6: *vr4100: *vr5000: *r3900: *micromips64: { if (SizeFGR () == 64) GPR[rt] = FGR[fs]; else if ((fs & 0x1) == 0) GPR[rt] = SET64HI (FGR[fs+1]) | FGR[fs]; else GPR[rt] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; TRACE_ALU_RESULT (GPR[rt]); } this was introduced here: commit 8e394ffc7ab691eafcf276d7ae578454a8c5548f Author: Andrew Bennett <andrew.bennett@imgtec.com> Date: Fri Sep 25 15:52:18 2015 +0100 [PATCH] Add micromips support to the MIPS simulator
the setting of 0xDEADC0DE & 0xBAD0BAD0 looks kind of bogus. based on other functions in here, like do_dmtc1b, i wonder if it shouldn't be: -- a/sim/mips/mips.igen +++ b/sim/mips/mips.igen @@ -1450,7 +1450,7 @@ else if ((fs & 0x1) == 0) GPR[rt] = SET64HI (FGR[fs+1]) | FGR[fs]; else - GPR[rt] = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; + Unpredictable (); TRACE_ALU_RESULT (GPR[rt]); } and should we do this for 010001,00001,5.RT,5.FS,00000000000:COP1:64,f::DMFC1a ? @@ -5782,7 +5782,7 @@ else if ((FS & 0x1) == 0) v = SET64HI (FGR[FS+1]) | FGR[FS]; else - v = SET64HI (0xDEADC0DE) | 0xBAD0BAD0; + Unpredictable (); PENDING_FILL (RT, v); TRACE_ALU_RESULT (v); }
posted a patch to do just that now https://sourceware.org/pipermail/gdb-patches/2022-November/193376.html
landed that patch for GDB 13. if the original authors prefer something different, feel free to post a follow up.