2001/herrmann2 requires 32-bit to work completely

By instinct I suspected that the reason it did not work fully (some
invocations do work) is that it's being compiled as 64-bit. This proved
to be the case: 32-bit works in full. Thus make alt now compiles it as
64-bit and the default compiles it as 32-bit.

To prevent making the Makefile more complicated for the default (not the
alt) target we add -m32 and the alt does not do anything special.

Updated bugs.md as the bug status and other information about it has
obviously changed. Same with README.md.

Updated .gitignore.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-26 03:46:52 -07:00
1 parent f3cf06eb85
commit e44a1ec7a5
5 files changed
+183 -124

No files matched your search

+1
View File
@@ -1 +1,2 @@
herrmann2
herrmann2.alt
+6 -3
View File
@@ -114,8 +114,8 @@ OBJ= ${PROG}.o
DATA= herrmann2.cup herrmann2.ioccc
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -130,13 +130,16 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${CC} ${CFLAGS} -m32 $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
${ALT_TARGET}: herrmann2.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# data files
#
data: ${DATA}
+16 -7
View File
@@ -16,7 +16,10 @@ make
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work with
clang by changing the args to main() to be `int` and `char **` respectively and
changing specific references to the `argv` arg, casting to int which was its old
type. Thank you Cody for your assistance!
type. However this entry only works completely if compiled as 32-bit (it does
work in part if compiled as 64-bit). See the alternate code below for
information on the 64-bit version and [bugs.md](/bugs.md) for more details on
this issue in general. Thank you Cody for your assistance!
## To run:
@@ -25,12 +28,18 @@ type. Thank you Cody for your assistance!
./herrmann2
```
Cody notes that [Yusuke Endoh](/winners.html#Yusuke_Endoh) does not get a
segfault with some of the invocations (without fixing it for clang) but Cody
does get a segfault both before fixing it for clang and after. Yusuke provides
some interesting thoughts which can be found
[here](https://mame-github-io.translate.goog/ioccc-ja-spoilers/2001/herrmann2.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en-US&_x_tr_pto=wapp).
Thank you Yusuke for your interesting thoughts!
### Alternate code:
As noted above an alternate version is available for 64-bit. This will crash in
some of the invocations given by the author but it will work for the basic
operations. To use try:
```sh
make alt
```
Use `herrmann2.alt` as you would `herrmann2` above and below.
## Try:
+6 -6
View File
@@ -1,15 +1,16 @@
char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char*d,A[9876];char
e;b;*ad,a,c; te;b;*ad,a,c; te;*ad,a,c; w,te;*ad,a, w,te;*ad,and, w,te;*ad,
r,T; wri; ;*h; r,T; wri; ;*h; r; wri; ;*h;_, r; wri;*h;_, r; wri;*har;_, r; wri
;on; ;l ;on; ;l ;o ;l ;o; pain(n,V){ -!har; {-!har; {har=A;{h=A;ad =A;read
;on;l;i(int V);on;l;i(int V);o;l;mai(int n,int V);o;mai(int n,int V);main(int n,char**V)
{-!har ; {-!har ; {har =A; {h =A;ad =A;read
(0,&e,o||n -- +(0,&e,o||n -- +(0,&o||n ,o-- +(0,&on ,o-4,- +(0,n ,o-=94,- +(0,n
,l=b=8,!( te-*A,l=b=8,!( te-*A,l=b,!( time-*A,l=b, time)|-*A,l= time(0)|-*A,l=
~l),srand (l),~l),srand (l),~l),and ,!(l),~l),a ,!(A,l),~l) ,!(d=A,l),~l)
,b))&&+((A + te,b))&&+((A + te,b))+((A -A+ te,b))+A -A+ (&te,b+A -A+(* (&te,b+A
)=+ +95>e?(*& c)=+ +95>e?(*& c) +95>e?(*& _*c) +95>(*& _*c) +95>(*&r= _*c) +95>
5,r+e-r +_:2-195,r+e-r +_:2-195+e-r +_:2-1<-95+e-r +_-1<-95+e-r?_-1<-95+e-r +1
|(d==d),++r,!n?*d||(d==d),!n ?*d||(d==d),!n?*d||(d==d),!n?*d||(d==d),!n?*d||(d=
*( (char**)+V+ *( (char)+V+ *( (c),har)+V+ (c),har)+ (V+ (c),r)+ (V+ ( c),
5,r+e-r +_:2-195,r+e-r +_:2-195+e-r +_:2-1<-95+e-r +_-1<-95+e-r ++?_-1<-95+e-r
|(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d==d),!n ?*d||(d=
*( (char**)+(int)V+ *( (char)+(int)V+ *( (c),har)+V+ (c),har)+ (V+ (c),r)+ (V+ ( c),
+0,*d-7 ) -r+8)+0,*d-7 -r+8)+0,*d-c:7 -r+80,*d-c:7 -r+7:80,*d-7 -r+7:80,*d++-7
+7+! r: and%9- +7+! rand%9-85 +7+! rand%95 +7+!! rand%95 +7+ rand()%95 +7+ r
-(r+o):(+w,_+ A-(r+o)+w,_+*( A-(r+o)+w,_+ A-(r=e+o)+w,_+ A-(r+o)+wri,_+ A-(r+o)
@@ -17,7 +18,6 @@ r,T; wri; ;*h; r,T; wri; ;*h; r; wri; ;*h;_, r; wri;*h;_, r; wri;*har;_, r; wri
-b+*h)(1,A+b,!!-b+*h),A+b,((!!-b+*h),A+b,!!-b+((*h),A+b,!!-b+*h),A-++b,!!-b+*h)
, a >T^l,( o-95, a >T,( o-=+95, a >T,( o-95, a)) >T,( o-95, a >T,(w? o-95, a >T
++ &&r:b<<2+a ++ &&b<<2+a+w ++ &&b<<2+w ++ ) &&b<<2+w ++ &&b<<((2+w ++ &&
!pain(n*n,V) , !pain(n,V) , !pain(+-n,V) ,pain(+-n,V) ) ,pain(n,V) ) ,pain),(n,
!main(n*n,V) , !main(n,V) , !main(+-n,V) ,main(+-n,V) ) ,main(n,V) ) ,main),(n,
l)),w= +T-->o +l)),w= +T>o +l)),w=o+ +T>o +l,w=o+ +T>o;{ +l,w=o+T>o;{ +l,w &=o+
!a;}return _+= !a;}return _+= !a;}return _+= !a;}return _+= !a;}return _+= !a;}
main (n,V)char **V;{ (void)V; return pain(n,0); return pain(n,0);return pain(n,0); }