lib/60413: iconv_samples test crashes on sparc*

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60413
>Category:       lib
>Synopsis:       iconv_samples test crashes on sparc*
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 05 16:20:00 +0000 2026
>Originator:     Martin Husemann
>Release:        NetBSD 11.99.6
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD thirdstage.duskware.de 11.99.6 NetBSD 11.99.6 (MODULAR) #901: Sat Jul 4 16:44:37 CEST 2026 [email protected]:/home/martin/current/src/sys/arch/sparc64/compile/MODULAR sparc64
Architecture: sparc64
Machine: sparc64
>Description:

Running the /usr/tests/lib/libc/locale/t_iconv test crashes on sparc*.

>How-To-Repeat:

cd /usr/tests/lib/libc/locale && gdb ./t_iconv
(gdb) run iconv_samples
test case 0: us-ascii to us-ascii from us-ascii to us-ascii
test case 0: us-ascii to us-ascii from us-ascii to us-ascii
test case 1: iso-8859-1 to UTF-8 from iso-8859-1 to UTF-8
test case 1: UTF-8 to iso-8859-1 from UTF-8 to iso-8859-1
test case 2: UTF-8 to ZW from UTF-8 to ZW
test case 2: ZW to UTF-8 from ZW to UTF-8
test case 3: UTF-8 to VIQR from UTF-8 to VIQR
test case 3: VIQR to UTF-8 from VIQR to UTF-8

Program received signal SIGBUS, Bus error.
_citrus_UTF8_stdenc_init_state (ce=0x40216840, ps=0x402bc072) at /home/martin/current/src/lib/libc/citrus/citrus_stdenc_template.h:105
105             _FUNCNAME(init_state)(_CE_TO_EI(ce), _TO_STATE(ps));
(gdb) ptype ps
type = void * restrict
(gdb) disas
Dump of assembler code for function _citrus_UTF8_stdenc_init_state:
   0x0000000041600da0 <+0>:     save  %sp, -176, %sp
=> 0x0000000041600da4 <+4>:     clr  [ %i1 + 8 ]
   0x0000000041600da8 <+8>:     return  %i7 + 8
   0x0000000041600dac <+12>:    clr  %o0
End of assembler dump.
(gdb) p/x $i1
$2 = 0x402bc072
(gdb) up
#2  init_encoding (se=0x402bc018, cs=<optimized out>, ps1=<optimized out>, ps2=0x402bc07e)
    at /home/martin/current/src/lib/libc/citrus/modules/citrus_iconv_std.c:165
165                     ret = _stdenc_init_state(cs, se->se_ps);
(gdb) p *se
$4 = {se_handle = 0x40216840, se_ps = 0x402bc072, se_pssaved = 0x402bc07e}
(gdb) ptype /o  _UTF8State
type = struct {
/*      0      |       6 */    char ch[6];
/* XXX  2-byte hole      */
/*      8      |       4 */    int chlen;

                               /* total size (bytes):   12 */
                             }

This means _UTF8State will require 4-byte alignment.
The void* passed is misalgined and _TO_STATE(ps) just is a plain cast.


>Fix:
n/a
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.