summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-02-12 23:11:07 +0000
committerKarl Berry <karl@freefriends.org>2023-02-12 23:11:07 +0000
commit3d88c5865c10e8b7d5aa712546c80b93116c332e (patch)
tree9c666665689810548586f77a65751bc4861c1254 /Build/source/texk/web2c
parent634a13fc4ef5429b15e523b444dc24d33e6e8a52 (diff)
propagate enctex \special changes to the new \special shipout, thus avoiding a (valid) compiler warning about assigning |write_stream(tail):=null|
git-svn-id: svn://tug.org/texlive/trunk@65806 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/ChangeLog8
-rw-r--r--Build/source/texk/web2c/enctexdir/enctex2.ch21
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web15
4 files changed, 51 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 6d462142582..32bf5330c12 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,11 @@
+2023-02-12 Phelype Oleinik <phe.h.o1@gmail.com>
+ and Karl Berry <karl@freefriends.org>
+
+ * enctexdir/enctex2.ch: make parallel change for ``late''
+ \special shipout. This code is what avoids the invalid
+ write_stream(tail):=null assignment in the original code.
+ See pdftex.web (Implement \.{\\special}) for more.
+
2023-01-28 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* Makefile.in, ac/web2c.ac (ptex, uptex):
diff --git a/Build/source/texk/web2c/enctexdir/enctex2.ch b/Build/source/texk/web2c/enctexdir/enctex2.ch
index 34a9aa04150..f397e66659c 100644
--- a/Build/source/texk/web2c/enctexdir/enctex2.ch
+++ b/Build/source/texk/web2c/enctexdir/enctex2.ch
@@ -600,6 +600,27 @@ else if mubyte_out + mubyte_zero >= 2*mubyte_zero then
else write_mubyte(tail) := mubyte_out + mubyte_zero;
@z
+% see pdftex.web for more about this.
+@x [53.1353] - encTeX: late \special stores specialout and mubyteout values
+begin new_whatsit(latespecial_node,write_node_size); write_stream(tail):=null;
+p:=scan_toks(false,false); write_tokens(tail):=def_ref;
+@y
+begin new_whatsit(latespecial_node,write_node_size);
+if spec_out + mubyte_zero < 0 then write_stream(tail) := 0
+else if spec_out + mubyte_zero >= 2*mubyte_zero then
+ write_stream(tail) := 2*mubyte_zero - 1
+ else write_stream(tail) := spec_out + mubyte_zero;
+if mubyte_out + mubyte_zero < 0 then write_mubyte(tail) := 0
+else if mubyte_out + mubyte_zero >= 2*mubyte_zero then
+ write_mubyte(tail) := 2*mubyte_zero - 1
+ else write_mubyte(tail) := mubyte_out + mubyte_zero;
+if (spec_out = 2) or (spec_out = 3) then
+ if (mubyte_out > 2) or (mubyte_out = -1) or (mubyte_out = -2) then
+ write_noexpanding := true;
+p:=scan_toks(false,false); write_tokens(tail):=def_ref;
+write_noexpanding := false;
+@z
+
@x [53.1353] - encTeX: \special stores specialout and mubyteout values
begin new_whatsit(special_node,write_node_size); write_stream(tail):=null;
p:=scan_toks(false,true); write_tokens(tail):=def_ref;
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index 937e5894ef0..9e0db193131 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,10 @@
+2023-02-12 Phelype Oleinik <phe.h.o1@gmail.com>
+ and Karl Berry <karl@freefriends.org>
+
+ * pdftex.web (Implement \.{\\special}): add comments explaining
+ that write_stream(tail):=null is an overflow assignment with the
+ current memory_word structure, and is overwritten in enctex2.ch.
+
2023-02-11 Thanh Han The <hanthethanh@gmail.com>
* pdftex.ch (pdf_font_has_space_char): xmalloc and maintain new array.
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index b4d251953df..fa3172c2df8 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -34003,6 +34003,21 @@ end
list as in \.{\\xdef} and \.{\\mark}. When marked with \.{shipout}, we keep
tokens unexpanded for now.
+Unfortunately, the |write_stream(tail):=null| done here is not a valid
+assignment in Web2C, because |null| (a.k.a.\ |min_halfword|) is a large
+negative number ($-268435455 = -@"FFFFFFF$, set in \.{tex.ch}); too
+large to fit in the {\bf short} structure element that's being assigned.
+The warning from gcc~8.5.0 was:
+
+\.{pdftex0.c: In function 'doextension':}
+\.{pdftex0.c:37849:40: warning: overflow in conversion from 'long int' to 'short int'}
+\.{changes value from '-268435455' to '1' [-Woverflow]}\hfil\break
+\.{ mem [curlist .tailfield + 1 ].hh.b0 = -268435455L ;}
+
+The correct thing to do is not immediately evident. However, for Web2C,
+it does not matter, because these lines are changed for enc\TeX, in
+\.{enctex2.ch}, and now zero is assigned, instead of |null|.
+
@<Implement \.{\\special}@>=
begin if scan_keyword("shipout") then
begin new_whatsit(latespecial_node,write_node_size); write_stream(tail):=null;