NetBSD Problem Report #59466

From martin@duskware.de  Fri Jun 13 13:34:10 2025
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8C1761A923C
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 Jun 2025 13:34:10 +0000 (UTC)
Message-Id: <20250613133407.7B11CA7DA3@mail.duskware.de>
Date: Fri, 13 Jun 2025 15:34:02 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: new gmake crashes when trying to build libxml2
X-Send-Pr-Version: 3.95

>Number:         59466
>Category:       port-sh3
>Synopsis:       new gmake crashes when trying to build libxml2
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-sh3-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 13 13:35:00 +0000 2025
>Last-Modified:  Mon Jun 16 06:00:02 +0000 2025
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.14
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD last-of-the-heroes.duskware.de 10.99.14 NetBSD 10.99.14 (GENERIC) #344: Tue Jun 10 10:59:38 CEST 2025 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/landisk/compile/GENERIC landisk
Architecture: sh3el
Machine: landisk
>Description:

Trying to build textproc/libxml2 on a 32bit little endian machine (sh3el)
fails reproducable for me:

Core was generated by `gmake'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x7763fd58 in strcmp (s1=0x77739325 "list.c", s2=<optimized out>)
    at /work/src/lib/libc/../../common/lib/libc/string/strcmp.c:60

warning: 60     /work/src/lib/libc/../../common/lib/libc/string/strcmp.c: No such file or directory
(gdb) bt
#0  0x7763fd58 in strcmp (s1=0x77739325 "list.c", s2=<optimized out>)
    at /work/src/lib/libc/../../common/lib/libc/string/strcmp.c:60
#1  0x0040e576 in hash_find_slot ()
#2  0x0041c8a6 in ?? ()
#3  0x0041ca94 in strcache_add_len ()
#4  0x00407c96 in ?? ()
#5  0x004081be in file_exists_p ()
#6  0x0040fb78 in ?? ()
#7  0x00410500 in try_implicit_rule ()
#8  0x0041a996 in ?? ()
#9  0x0041b32a in ?? ()
#10 0x0041ab14 in ?? ()
#11 0x0041b32a in ?? ()
#12 0x0041ab14 in ?? ()
#13 0x0041b32a in ?? ()
#14 0x0041ab14 in ?? ()
#15 0x0041b32a in ?? ()
#16 0x0041ab14 in ?? ()
#17 0x0041b71a in update_goal_chain ()
#18 0x004235a6 in main ()


>How-To-Repeat:
s/a

>Fix:
backout gmake update?

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/59466: new gmake crashes when trying to build libxml2
Date: Fri, 13 Jun 2025 15:39:30 +0200

 Sorry if that last sentence came across wrong - downgrading gmake makes
 of course no sense and whatever triggers this needs to be debugged instead
 (I'm working on that but the affected machine is not exactly fast).

 Martin

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/59466: new gmake crashes when trying to build libxml2
Date: Fri, 13 Jun 2025 20:05:30 +0200

 With symbols this looks like:

 (gdb) bt
 #0  0x7627fd58 in strcmp (s1=0x7637300d ".", s2=<optimized out>)
     at /work/src/lib/libc/../../common/lib/libc/string/strcmp.c:60
 #1  0x0043a154 in str_hash_cmp (x=0x7637300d, y=0x371d05) at src/strcache.c:175
 #2  0x00418104 in hash_find_slot (ht=0x465d5c <strings>, key=0x7637300d)
     at src/hash.c:109
 #3  0x0043a1be in add_hash (str=0x7637300d ".", len=1) at src/strcache.c:193
 #4  0x0043a46c in strcache_add_len (str=0x7637300d ".", len=1)
     at src/strcache.c:253
 #5  0x0040a54e in dir_contents_file_exists_p (dir=0x76122840, 
     filename=0x76056c4f "xmlschemastypes.w") at src/dir.c:771
 #6  0x0040a6c4 in dir_file_exists_p (dirname=0x446260 ".", 
     filename=0x76056c4f "xmlschemastypes.w") at src/dir.c:808
 #7  0x0040a75c in file_exists_p (name=0x76056c4f "xmlschemastypes.w")
     at src/dir.c:857
 #8  0x0041b5a6 in pattern_search (file=0x7607e060, archive=0, depth=6, 
     recursions=0, allow_compat_rules=0) at src/implicit.c:833
 #9  0x00419986 in try_implicit_rule (file=0x7607e060, depth=5)
     at src/implicit.c:48
 #10 0x004341c4 in update_file_1 (file=0x7607e060, depth=5) at src/remake.c:557
 #11 0x004337fa in update_file (file=0x7607e060, depth=4) at src/remake.c:367
 #12 0x00435c16 in check_dep (file=0x7607e060, depth=4, this_mtime=1, 
     must_make_ptr=0x7ff6aa60) at src/remake.c:1100
 #13 0x0043454a in update_file_1 (file=0x76377d00, depth=4) at src/remake.c:633
 #14 0x004337fa in update_file (file=0x76377d00, depth=3) at src/remake.c:367
 #15 0x00435c16 in check_dep (file=0x76377d00, depth=3, this_mtime=1, 
     must_make_ptr=0x7ff6ab90) at src/remake.c:1100
 #16 0x0043454a in update_file_1 (file=0x76376ec0, depth=3) at src/remake.c:633
 #17 0x004337fa in update_file (file=0x76376ec0, depth=2) at src/remake.c:367
 #18 0x00435c16 in check_dep (file=0x76376ec0, depth=2, this_mtime=1, 
     must_make_ptr=0x7ff6acc0) at src/remake.c:1100
 #19 0x0043454a in update_file_1 (file=0x76376c20, depth=2) at src/remake.c:633
 #20 0x004337fa in update_file (file=0x76376c20, depth=1) at src/remake.c:367
 #21 0x00435c16 in check_dep (file=0x76376c20, depth=1, this_mtime=1, 
     must_make_ptr=0x7ff6adf0) at src/remake.c:1100
 #22 0x0043454a in update_file_1 (file=0x76375000, depth=1) at src/remake.c:633
 #23 0x004337fa in update_file (file=0x76375000, depth=0) at src/remake.c:367
 #24 0x004330fe in update_goal_chain (goaldeps=0x761110f0) at src/remake.c:184
 #25 0x00425eca in main (argc=2, argv=0x7ff6c308, envp=0x7ff6c314)
     at src/main.c:2918

 and the gmake invocation is: gmake all-am

 Martin

Responsible-Changed-From-To: pkg-manager->port-sh3-maintainer
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sat, 14 Jun 2025 10:00:44 +0000
Responsible-Changed-Why:
Seems to be a gcc bug


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sh3/59466 (new gmake crashes when trying to build libxml2)
Date: Sat, 14 Jun 2025 12:36:09 +0200

 This seems to be a gcc issue. The crash happens here:

 #2  0x00418104 in hash_find_slot (ht=0x465d5c <strings>, key=0x7637300d) at src/hash.c:109
 109               if ((*ht->ht_compare) (key, *slot) == 0)


 the function looks like this:

 /* Returns the address of the table slot matching 'key'.  If 'key' is
    not found, return the address of an empty slot suitable for
    inserting 'key'.  The caller is responsible for incrementing
    ht_fill on insertion.  */

 void **
 hash_find_slot (struct hash_table *ht, const void *key)
 {
   void **slot;
   void **deleted_slot = 0;
   unsigned int hash_2 = 0;
   unsigned int hash_1 = (*ht->ht_hash_1) (key);

   ht->ht_lookups++;
   for (;;)
     {
       hash_1 &= (ht->ht_size - 1); 
       slot = &ht->ht_vec[hash_1];

       if (*slot == 0)
         return (deleted_slot ? deleted_slot : slot);
       if (*slot == hash_deleted_item)
         {
           if (deleted_slot == 0)
             deleted_slot = slot;
         }
       else
         {
           if (key == *slot)
             return slot;
 >>>       if ((*ht->ht_compare) (key, *slot) == 0)
             return slot; 
           ht->ht_collisions++;
         }
       if (!hash_2)
           hash_2 = (*ht->ht_hash_2) (key) | 1;
       hash_1 += hash_2;
     }
 }


 And in this case we have (not suprisingly) found the key in the hash:

 (gdb) p (const char *)key
 $1 = 0x7637300d "."
 (gdb) p (const char *)(*slot)
 $2 = 0x760ff0d5 "."

 All types seem to match, no argument promotion involved:

 (gdb) ptype key
 type = void *
 (gdb) ptype *slot
 type = void *
 (gdb) ptype ht->ht_compare
 type = int (*)(const void *, const void *)

 and ht_compare is 

 (gdb) p ht->ht_compare
 $3 = (hash_cmp_func_t) 0x43a11e <str_hash_cmp>

 but: that already receives the wrong arguments:

 (gdb) down
 #1  0x0043a154 in str_hash_cmp (x=0x7637300d, y=0x371d05) at src/strcache.c:175
 175       return_ISTRING_COMPARE ((const char *) x, (const char *) y);

 Note that x matches "key" from the call site, but y is different
 (0x371d05 != 0x760ff0d5 aka *slot from the call site).

 The function str_hash_cmp is simple:

 static int
 str_hash_cmp (const void *x, const void *y)
 {
   return_ISTRING_COMPARE ((const char *) x, (const char *) y);
 }

 and return_ISTRING_COMPARE is a macro:

 #define return_ISTRING_COMPARE(X, Y) return_STRING_COMPARE ((X), (Y))

 with 

 #define return_STRING_COMPARE(X, Y) do { \
   return (X) == (Y) ? 0 : strcmp ((X), (Y)); \
 } while (0)

 But the critical question is: how come the function pointer call ends
 up with a garbled second argument?

 (gdb) disas hash_find_slot
 Dump of assembler code for function hash_find_slot:
    0x00417ff0 <+0>:     mov.l   r8,@-r15
    0x00417ff2 <+2>:     mov.l   r14,@-r15
    0x00417ff4 <+4>:     sts.l   pr,@-r15
    0x00417ff6 <+6>:     add     #-24,r15
    0x00417ff8 <+8>:     mov     r15,r14
    0x00417ffa <+10>:    mov     r14,r1
    0x00417ffc <+12>:    add     #-40,r1
    0x00417ffe <+14>:    mov.l   r4,@(44,r1)
    0x00418000 <+16>:    mov     r14,r1
    0x00418002 <+18>:    add     #-40,r1
    0x00418004 <+20>:    mov.l   r5,@(40,r1)
    0x00418006 <+22>:    mov     r14,r1
    0x00418008 <+24>:    add     #-40,r1
    0x0041800a <+26>:    mov     #0,r2
    0x0041800c <+28>:    mov.l   r2,@(48,r1)
    0x0041800e <+30>:    mov     r14,r1
    0x00418010 <+32>:    add     #-40,r1
    0x00418012 <+34>:    mov     #0,r2
    0x00418014 <+36>:    mov.l   r2,@(52,r1)
    0x00418016 <+38>:    mov     r14,r1
    0x00418018 <+40>:    add     #-40,r1
    0x0041801a <+42>:    mov.l   @(44,r1),r1
    0x0041801c <+44>:    mov.l   @(4,r1),r1
    0x0041801e <+46>:    mov     r14,r8
    0x00418020 <+48>:    add     #-40,r8
    0x00418022 <+50>:    mov     r14,r2
    0x00418024 <+52>:    add     #-40,r2
    0x00418026 <+54>:    mov.l   @(40,r2),r4
    0x00418028 <+56>:    jsr     @r1
    0x0041802a <+58>:    nop     
    0x0041802c <+60>:    mov     r0,r1
    0x0041802e <+62>:    mov.l   r1,@(56,r8)
    0x00418030 <+64>:    mov     r14,r1
    0x00418032 <+66>:    add     #-40,r1
    0x00418034 <+68>:    mov.l   @(44,r1),r1
    0x00418036 <+70>:    mov.l   @(36,r1),r1
    0x00418038 <+72>:    mov     r1,r2
    0x0041803a <+74>:    add     #1,r2
    0x0041803c <+76>:    mov     r14,r1
    0x0041803e <+78>:    add     #-40,r1
    0x00418040 <+80>:    mov.l   @(44,r1),r1
    0x00418042 <+82>:    mov.l   r2,@(36,r1)
    0x00418044 <+84>:    mov     r14,r1
    0x00418046 <+86>:    add     #-40,r1
    0x00418048 <+88>:    mov.l   @(44,r1),r1
    0x0041804a <+90>:    mov.l   @(16,r1),r1
    0x0041804c <+92>:    mov     r1,r2
    0x0041804e <+94>:    add     #-1,r2
    0x00418050 <+96>:    mov     r14,r1
    0x00418052 <+98>:    add     #-40,r1
    0x00418054 <+100>:   mov     r14,r3
    0x00418056 <+102>:   add     #-40,r3
    0x00418058 <+104>:   mov.l   @(56,r3),r3
    0x0041805a <+106>:   and     r3,r2
    0x0041805c <+108>:   mov.l   r2,@(56,r1)
    0x0041805e <+110>:   mov     r14,r1
    0x00418060 <+112>:   add     #-40,r1
    0x00418062 <+114>:   mov.l   @(44,r1),r1
    0x00418064 <+116>:   mov.l   @r1,r3
    0x00418066 <+118>:   mov     r14,r1
    0x00418068 <+120>:   add     #-40,r1
    0x0041806a <+122>:   mov.l   @(56,r1),r1
    0x0041806c <+124>:   mov     r1,r2
    0x0041806e <+126>:   shll2   r2
    0x00418070 <+128>:   mov     r14,r1
    0x00418072 <+130>:   add     #-40,r1
    0x00418074 <+132>:   add     r3,r2
    0x00418076 <+134>:   mov.l   r2,@(60,r1)
    0x00418078 <+136>:   mov     r14,r1
    0x0041807a <+138>:   add     #-40,r1
    0x0041807c <+140>:   mov.l   @(60,r1),r1
    0x0041807e <+142>:   mov.l   @r1,r1
    0x00418080 <+144>:   tst     r1,r1
    0x00418082 <+146>:   bf      0x4180a2 <hash_find_slot+178>
    0x00418084 <+148>:   mov     r14,r1
    0x00418086 <+150>:   add     #-40,r1
    0x00418088 <+152>:   mov.l   @(48,r1),r1
    0x0041808a <+154>:   tst     r1,r1
    0x0041808c <+156>:   bt      0x418098 <hash_find_slot+168>
    0x0041808e <+158>:   mov     r14,r1
    0x00418090 <+160>:   add     #-40,r1
    0x00418092 <+162>:   mov.l   @(48,r1),r1
    0x00418094 <+164>:   bra     0x418168 <hash_find_slot+376>
    0x00418096 <+166>:   nop     
    0x00418098 <+168>:   mov     r14,r1
    0x0041809a <+170>:   add     #-40,r1
    0x0041809c <+172>:   mov.l   @(60,r1),r1
    0x0041809e <+174>:   bra     0x418168 <hash_find_slot+376>
    0x004180a0 <+176>:   nop     
    0x004180a2 <+178>:   mov     r14,r1
    0x004180a4 <+180>:   add     #-40,r1
    0x004180a6 <+182>:   mov.l   @(60,r1),r1
    0x004180a8 <+184>:   mov.l   @r1,r2
    0x004180aa <+186>:   mov.l   0x418178 <hash_find_slot+392>,r1        ! 4629f8
    0x004180ac <+188>:   mov.l   @r1,r1
    0x004180ae <+190>:   cmp/eq  r1,r2
    0x004180b0 <+192>:   bf      0x4180cc <hash_find_slot+220>
    0x004180b2 <+194>:   mov     r14,r1
    0x004180b4 <+196>:   add     #-40,r1
    0x004180b6 <+198>:   mov.l   @(48,r1),r1
    0x004180b8 <+200>:   tst     r1,r1
    0x004180ba <+202>:   bf      0x418128 <hash_find_slot+312>
    0x004180bc <+204>:   mov     r14,r1
    0x004180be <+206>:   add     #-40,r1
    0x004180c0 <+208>:   mov     r14,r2
    0x004180c2 <+210>:   add     #-40,r2
    0x004180c4 <+212>:   mov.l   @(60,r2),r2
    0x004180c6 <+214>:   mov.l   r2,@(48,r1)
    0x004180c8 <+216>:   bra     0x418128 <hash_find_slot+312>
    0x004180ca <+218>:   nop     
    0x004180cc <+220>:   mov     r14,r1
    0x004180ce <+222>:   add     #-40,r1
    0x004180d0 <+224>:   mov.l   @(60,r1),r1
    0x004180d2 <+226>:   mov.l   @r1,r1
    0x004180d4 <+228>:   mov     r14,r2
    0x004180d6 <+230>:   add     #-40,r2
    0x004180d8 <+232>:   mov.l   @(40,r2),r2
    0x004180da <+234>:   cmp/eq  r1,r2
    0x004180dc <+236>:   bf      0x4180e8 <hash_find_slot+248>
    0x004180de <+238>:   mov     r14,r1
    0x004180e0 <+240>:   add     #-40,r1
    0x004180e2 <+242>:   mov.l   @(60,r1),r1
    0x004180e4 <+244>:   bra     0x418168 <hash_find_slot+376>
    0x004180e6 <+246>:   nop     
    0x004180e8 <+248>:   mov     r14,r1
    0x004180ea <+250>:   add     #-40,r1
    0x004180ec <+252>:   mov.l   @(44,r1),r1
    0x004180ee <+254>:   mov.l   @(12,r1),r1	# r1 = ht->ht_compare
    0x004180f0 <+256>:   mov     r14,r2
    0x004180f2 <+258>:   add     #-40,r2
    0x004180f4 <+260>:   mov.l   @(60,r2),r2	# r2 = slot
    0x004180f6 <+262>:   mov.l   @r2,r3		# r3 = *slot
    0x004180f8 <+264>:   mov     r14,r2
    0x004180fa <+266>:   add     #-40,r2
    0x004180fc <+268>:   mov     r3,r5		# r5 = *slot
    0x004180fe <+270>:   mov.l   @(40,r2),r4	# r4 = key
    0x00418100 <+272>:   jsr     @r1		# call ht->ht_compare(r4, r5)
    0x00418102 <+274>:   nop     
 => 0x00418104 <+276>:   mov     r0,r1
    0x00418106 <+278>:   tst     r1,r1
    0x00418108 <+280>:   bf      0x418114 <hash_find_slot+292>
    0x0041810a <+282>:   mov     r14,r1
    0x0041810c <+284>:   add     #-40,r1
    0x0041810e <+286>:   mov.l   @(60,r1),r1
    0x00418110 <+288>:   bra     0x418168 <hash_find_slot+376>
    0x00418112 <+290>:   nop     
    0x00418114 <+292>:   mov     r14,r1
    0x00418116 <+294>:   add     #-40,r1
    0x00418118 <+296>:   mov.l   @(44,r1),r1
    0x0041811a <+298>:   mov.l   @(32,r1),r1
    0x0041811c <+300>:   mov     r1,r2
    0x0041811e <+302>:   add     #1,r2
    0x00418120 <+304>:   mov     r14,r1
    0x00418122 <+306>:   add     #-40,r1
    0x00418124 <+308>:   mov.l   @(44,r1),r1
    0x00418126 <+310>:   mov.l   r2,@(32,r1)
    0x00418128 <+312>:   mov     r14,r1
    0x0041812a <+314>:   add     #-40,r1
    0x0041812c <+316>:   mov.l   @(52,r1),r1
    0x0041812e <+318>:   tst     r1,r1
    0x00418130 <+320>:   bf      0x418150 <hash_find_slot+352>
    0x00418132 <+322>:   mov     r14,r1
    0x00418134 <+324>:   add     #-40,r1
    0x00418136 <+326>:   mov.l   @(44,r1),r1
    0x00418138 <+328>:   mov.l   @(8,r1),r1
    0x0041813a <+330>:   mov     r14,r2
    0x0041813c <+332>:   add     #-40,r2
    0x0041813e <+334>:   mov.l   @(40,r2),r4
    0x00418140 <+336>:   jsr     @r1
    0x00418142 <+338>:   nop     
    0x00418144 <+340>:   mov     r0,r1
    0x00418146 <+342>:   mov     r14,r2
    0x00418148 <+344>:   add     #-40,r2
    0x0041814a <+346>:   mov     #1,r3
    0x0041814c <+348>:   or      r3,r1
    0x0041814e <+350>:   mov.l   r1,@(52,r2)
    0x00418150 <+352>:   mov     r14,r1
    0x00418152 <+354>:   add     #-40,r1
    0x00418154 <+356>:   mov     r14,r3
    0x00418156 <+358>:   add     #-40,r3
    0x00418158 <+360>:   mov     r14,r2
    0x0041815a <+362>:   add     #-40,r2
    0x0041815c <+364>:   mov.l   @(56,r3),r3
    0x0041815e <+366>:   mov.l   @(52,r2),r2
    0x00418160 <+368>:   add     r3,r2
    0x00418162 <+370>:   mov.l   r2,@(56,r1)
    0x00418164 <+372>:   bra     0x418044 <hash_find_slot+84>
    0x00418166 <+374>:   nop     
    0x00418168 <+376>:   mov     r1,r0
    0x0041816a <+378>:   add     #24,r14
    0x0041816c <+380>:   mov     r14,r15
    0x0041816e <+382>:   lds.l   @r15+,pr
    0x00418170 <+384>:   mov.l   @r15+,r14
    0x00418172 <+386>:   mov.l   @r15+,r8
    0x00418174 <+388>:   rts     
    0x00418176 <+390>:   nop     
    0x00418178 <+392>:   tst     r15,r9
    0x0041817a <+394>:   mov.l   r4,@(r0,r0)
 End of assembler dump.

 The call site looks correct to me.


 (gdb) disas str_hash_cmp
 Dump of assembler code for function str_hash_cmp:
    0x0043a11e <+0>:     mov.l   r14,@-r15
    0x0043a120 <+2>:     sts.l   pr,@-r15
    0x0043a122 <+4>:     add     #-8,r15
    0x0043a124 <+6>:     mov     r15,r14
    0x0043a126 <+8>:     mov     r14,r1
    0x0043a128 <+10>:    add     #-56,r1
    0x0043a12a <+12>:    mov.l   r4,@(60,r1)	# save x on stack
    0x0043a12c <+14>:    mov     r14,r1
    0x0043a12e <+16>:    add     #-56,r1
    0x0043a130 <+18>:    mov.l   r5,@(56,r1)	# save y on stack
    0x0043a132 <+20>:    mov     r14,r2
    0x0043a134 <+22>:    add     #-56,r2
    0x0043a136 <+24>:    mov     r14,r1
    0x0043a138 <+26>:    add     #-56,r1
    0x0043a13a <+28>:    mov.l   @(60,r2),r2	# r2 = x
    0x0043a13c <+30>:    mov.l   @(56,r1),r1	# r1 = y
    0x0043a13e <+32>:    cmp/eq  r1,r2		# x == y ?
    0x0043a140 <+34>:    bt      0x43a15a <str_hash_cmp+60>
    0x0043a142 <+36>:    mov     r14,r2
    0x0043a144 <+38>:    add     #-56,r2
    0x0043a146 <+40>:    mov     r14,r1
    0x0043a148 <+42>:    add     #-56,r1
    0x0043a14a <+44>:    mov.l   @(56,r2),r5	# r5 = y
    0x0043a14c <+46>:    mov.l   @(60,r1),r4	# r4 = x
    0x0043a14e <+48>:    mov.l   0x43a16c <str_hash_cmp+78>,r1   ! 405204
    0x0043a150 <+50>:    jsr     @r1
    0x0043a152 <+52>:    nop     
 => 0x0043a154 <+54>:    mov     r0,r1
    0x0043a156 <+56>:    bra     0x43a15c <str_hash_cmp+62>
    0x0043a158 <+58>:    nop     
    0x0043a15a <+60>:    mov     #0,r1
    0x0043a15c <+62>:    mov     r1,r0
    0x0043a15e <+64>:    add     #8,r14
    0x0043a160 <+66>:    mov     r14,r15
    0x0043a162 <+68>:    lds.l   @r15+,pr
    0x0043a164 <+70>:    mov.l   @r15+,r14
    0x0043a166 <+72>:    rts     
    0x0043a168 <+74>:    nop     
    0x0043a16a <+76>:    nop     
    0x0043a16c <+78>:    mov.l   @(16,r0),r2
    0x0043a16e <+80>:    .word 0x0040
 End of assembler dump.

 .. and I don't see what the calle does wrong before invoking strcmp() either.

 The stupid stores and loads are an artefact of compiling gmake with -g and
 no optimiziation (I guess), but exactly the same crash happens in the
 regular pkgsrc build of gmake.

 Martin

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sh3/59466 (new gmake crashes when trying to build libxml2)
Date: Sat, 14 Jun 2025 13:34:31 +0200

 I hacked around it (as I urgently needed a new libxml2) by the patch 
 below - of course that is incorrect and disables the optimization this
 thing is all about, so not commitable.

 Martin

 --- hash.c.orig	2022-11-13 16:38:50.000000000 +0100
 +++ hash.c	2025-06-14 12:46:56.273417363 +0200
 @@ -106,6 +106,13 @@ hash_find_slot (struct hash_table *ht, c
          {
            if (key == *slot)
              return slot;
 +
 +	  /* hack around port-sh3/59466 */
 +	  const char *k = (const char *)key;
 +	  const char *s = (const char *)*slot;
 +	  if (k[0] == s[0] && k[1] == 0 && s[1] == 0)
 +	    return slot;
 +
            if ((*ht->ht_compare) (key, *slot) == 0)
              return slot;
            ht->ht_collisions++;

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sh3/59466 (new gmake crashes when trying to build libxml2)
Date: Sun, 15 Jun 2025 22:58:55 +0300

 What are the exact versions?  I have a fairly recent current with

 $ ls -l /bin/sh
 -r-xr-xr-x  1 root  wheel  212840 Apr 26 04:00 /bin/sh*

 $ gcc --version | sed 1q
 gcc (nb1 20240630) 12.4.0

 $ gmake --version | sed 1q
 GNU Make 4.4.1

 $ cat CVS/Tag
 Tpkgsrc-2025Q1

 And it build libxml2 package just fine:

 ...
 gmake[1]: Leaving directory '/usr/pkgsrc/textproc/libxml2/work.sh3el/libxml2-2.12.10'


 The asm you quote above seems ok too.

 -uwe

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-sh3/59466 (new gmake crashes when trying to build libxml2)
Date: Mon, 16 Jun 2025 07:59:46 +0200

 On Sun, Jun 15, 2025 at 08:05:01PM +0000, Valery Ushakov via gnats wrote:
 >  What are the exact versions?  I have a fairly recent current with
 >  
 >  $ ls -l /bin/sh
 >  -r-xr-xr-x  1 root  wheel  212840 Apr 26 04:00 /bin/sh*
 >  
 >  $ gcc --version | sed 1q
 >  gcc (nb1 20240630) 12.4.0
 >  
 >  $ gmake --version | sed 1q
 >  GNU Make 4.4.1
 >  
 >  $ cat CVS/Tag
 >  Tpkgsrc-2025Q1
 >  
 >  And it build libxml2 package just fine:

 Yeah, it previously worked, this is some new regression and might be
 specific to some changes in pkgsrc.

 I have:


  > ls -l /bin/sh
 -r-xr-xr-x  1 root  wheel  212296 Jun 10 10:26 /bin/sh*
  > gcc --version | sed 1q
 gcc (nb1 20240630) 12.4.0
  > gmake --version | sed 1q
 GNU Make 4.4.1


 and it was pkgsrc-current as of June 14, and the pkg failing to build is

 libxml2-2.14.3


 Martin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.