Closed Midar closed 12 months ago
this reproduced the bug: http://franke.ms/cex/z/85Ed9M
the lines 43-45 read
move.l (a2),(a0)
move.l (a2),a0
move.l a2,(4,a0)
with the fix it's
move.l (a2),a0
move.l a0,(a0)
move.l (a2),a0
move.l a2,(4,a0)
http://franke.ms/cex/z/85Ed9M now shows the correct code
With the recent commits, it seems to get a lot farther now.
GCC also gets confused about initialization when using -Os
.
Here's (simplified) code:
+ (id)handler
{
id handler;
[globalMutex lock];
@try {
handler = somethingReturningTheHandler();
} @finally {
[globalMutex unlock];
}
if (handler == nil)
@throw [SomeException exception];
return handler;
}
GCC complains with -Os
that on return handler
, handler
could be uninitialized. However, if handler
isn't initialized, this code is never reached as it means an exception was thrown and the control flow stopped.
GCC complains with
-Os
that onreturn handler
,handler
could be uninitialized. However, ifhandler
isn't initialized, this code is never reached as it means an exception was thrown and the control flow stopped.
I can't help there
and using double
for seconds is also not a good choice on the Amiga. Use long long
instead.
long long doesn't have more than second precision. double allows the precision to be scaled with how far away the date is, which is very desirable: Nobody cares about nanosecond granularity for a date in the year 10524.
Building with everything above -O0 seems to cause miscompiles leading to crashes. I don't have any specific example, since it seems so many things are miscompiled. From what I've seen when compiling ObjFW with -O1, -O2 and -Os:
-O1: Mostly works, until some loop gets miscompiled. -O2: Immediately crashes -Os: Immediately has an assertion fail
I'm not sure where to start at all, given how much is being miscompiled. But being able to use something better than -O0 would benefit such old hardware a lot.