public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related)
@ 2023-08-17  6:17 wbx at openadk dot org
  2023-08-17  7:22 ` [Bug math/30773] " schwab@linux-m68k.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: wbx at openadk dot org @ 2023-08-17  6:17 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

            Bug ID: 30773
           Summary: [m68k] busybox awk is broken (lshift.S related)
           Product: glibc
           Version: 2.38
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: wbx at openadk dot org
  Target Milestone: ---

Hi,

Running glibc 2.38 system in qemu-system-m68k (machine virt, cpu m68040).
Patch from here is applied
https://sourceware.org/bugzilla/show_bug.cgi?id=30740.

There is one issue, this oneliner does not work, I use it to show the ip
address of the system:
ipaddr=$(ip addr show $(ip route show|awk '/default/ { print $5 }')|awk '/inet
/ { print $2 }'|tail -1)

With strace I get:
Fatal glibc error: printf_fp.c:501 (__printf_fp_buffer_1): assertion failed: cy
== 1 || (p.frac[p.fracsize - 2] == 0 && p.frac[0] == 0)
Aborted

Removing sysdeps/m68k/m680x0/lshift.S fixes the issue.

best regards
 Waldemar

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
@ 2023-08-17  7:22 ` schwab@linux-m68k.org
  2023-08-17  9:36 ` wbx at openadk dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: schwab@linux-m68k.org @ 2023-08-17  7:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-08-17
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Please provide a self-contained test case.  What exactly does gawk pass to
printf?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
  2023-08-17  7:22 ` [Bug math/30773] " schwab@linux-m68k.org
@ 2023-08-17  9:36 ` wbx at openadk dot org
  2023-08-17 10:39 ` schwab@linux-m68k.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: wbx at openadk dot org @ 2023-08-17  9:36 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

--- Comment #2 from wbx at openadk dot org ---
root@openadk:~ # ip route show                                             
default via 10.0.2.2 dev eth0 
10.0.2.0/24 dev eth0 scope link  src 10.0.2.15 
root@openadk:~ # ip route show|awk '/default/ { print $5 }'                     
dev

This normally should give eth0 instead of dev. It is not gawk, it is busybox
awk, which is failing here. But I now checked with gawk, and it has the same
problem.

Does that help?

best regards
 Waldemar

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
  2023-08-17  7:22 ` [Bug math/30773] " schwab@linux-m68k.org
  2023-08-17  9:36 ` wbx at openadk dot org
@ 2023-08-17 10:39 ` schwab@linux-m68k.org
  2023-08-17 12:29 ` adhemerval.zanella at linaro dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: schwab@linux-m68k.org @ 2023-08-17 10:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
Worksforme.  Most probably an emulation bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (2 preceding siblings ...)
  2023-08-17 10:39 ` schwab@linux-m68k.org
@ 2023-08-17 12:29 ` adhemerval.zanella at linaro dot org
  2023-08-17 14:03 ` schwab@linux-m68k.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-08-17 12:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Waldemar forgot to said his build was done with -mcpu=68040. And this option
gcc  does not define __mc68020__, which makes sysdeps/m68k/m680x0/lshift.S and
sysdeps/m68k/m680x0/rshift.S use a code path for not m68000 (which does seem
wrong).

This following fix does make the m68040 build prints the expected value:

diff --git a/sysdeps/m68k/m680x0/lshift.S b/sysdeps/m68k/m680x0/lshift.S
index 2aee10348e..bfb6d5580a 100644
--- a/sysdeps/m68k/m680x0/lshift.S
+++ b/sysdeps/m68k/m680x0/lshift.S
@@ -57,7 +57,7 @@ ENTRY(__mpn_lshift)
        bne     L(Lnormal)
        cmpl    R(s_ptr),R(res_ptr)
        bls     L(Lspecial)             /* jump if s_ptr >= res_ptr */
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
+#if defined (__mc68020__) || defined (__mc68040__)
        lea     MEM_INDX1(s_ptr,s_size,l,4),R(a2)
 #else /* not mc68020 */
        movel   R(s_size),R(d0)
@@ -71,7 +71,7 @@ L(Lnormal:)
        moveql  #32,R(d5)
        subl    R(cnt),R(d5)

-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
+#if defined (__mc68020__) || defined (__mc68040__)
        lea     MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr)
        lea     MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr)
 #else /* not mc68000 */
diff --git a/sysdeps/m68k/m680x0/rshift.S b/sysdeps/m68k/m680x0/rshift.S
index d16bca9307..c8735c3bf1 100644
--- a/sysdeps/m68k/m680x0/rshift.S
+++ b/sysdeps/m68k/m680x0/rshift.S
@@ -56,7 +56,7 @@ ENTRY(__mpn_rshift)
        bne     L(Lnormal)
        cmpl    R(res_ptr),R(s_ptr)
        bls     L(Lspecial)             /* jump if res_ptr >= s_ptr */
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
+#if defined (__mc68020__) || defined (__mc68040__)
        lea     MEM_INDX1(res_ptr,s_size,l,4),R(a2)
 #else /* not mc68020 */
        movel   R(s_size),R(d0)
@@ -121,7 +121,7 @@ L(Lend:)

        cfi_restore_state
 L(Lspecial:)
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
+#if defined (__mc68020__) || defined (__mc68040__)
        lea     MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr)
        lea     MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr)
 #else /* not mc68000 */

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (3 preceding siblings ...)
  2023-08-17 12:29 ` adhemerval.zanella at linaro dot org
@ 2023-08-17 14:03 ` schwab@linux-m68k.org
  2023-08-17 14:09 ` adhemerval.zanella at linaro dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: schwab@linux-m68k.org @ 2023-08-17 14:03 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> ---
diff --git a/sysdeps/m68k/m680x0/lshift.S b/sysdeps/m68k/m680x0/lshift.S
index 2aee10348e..4240738959 100644
--- a/sysdeps/m68k/m680x0/lshift.S
+++ b/sysdeps/m68k/m680x0/lshift.S
@@ -77,8 +77,8 @@ L(Lnormal:)
 #else /* not mc68000 */
        movel   R(s_size),R(d0)
        asll    #2,R(d0)
-       addl    R(s_size),R(s_ptr)
-       addl    R(s_size),R(res_ptr)
+       addl    R(d0),R(s_ptr)
+       addl    R(d0),R(res_ptr)
 #endif
        movel   MEM_PREDEC(s_ptr),R(d2)
        movel   R(d2),R(d0)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (4 preceding siblings ...)
  2023-08-17 14:03 ` schwab@linux-m68k.org
@ 2023-08-17 14:09 ` adhemerval.zanella at linaro dot org
  2023-08-17 14:35 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-08-17 14:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

--- Comment #6 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Ok, but this is a different issue I think.  Since this code is originally
copied from gmplib, mpn/m68k/m68k-defs.m4 has:

define(scale_available_p,
`m4_ifdef_anyof_p(
`HAVE_HOST_CPU_m68360'
`HAVE_HOST_CPU_m68020'
`HAVE_HOST_CPU_m68030'
`HAVE_HOST_CPU_m68040'
`HAVE_HOST_CPU_m68060')')

So glibc should also checks for __mc68030__, __mc68040__, __mc68060__, instead
of just __mc68020__.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (5 preceding siblings ...)
  2023-08-17 14:09 ` adhemerval.zanella at linaro dot org
@ 2023-08-17 14:35 ` schwab@linux-m68k.org
  2023-08-18  5:01 ` sam at gentoo dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: schwab@linux-m68k.org @ 2023-08-17 14:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

--- Comment #7 from Andreas Schwab <schwab@linux-m68k.org> ---
It was correct when it was copied verbatim from gmp.  The problem is that gcc
has changed in the mean time.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (6 preceding siblings ...)
  2023-08-17 14:35 ` schwab@linux-m68k.org
@ 2023-08-18  5:01 ` sam at gentoo dot org
  2023-08-18  6:19 ` wbx at openadk dot org
  2023-08-18  7:04 ` sam at gentoo dot org
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2023-08-18  5:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

--- Comment #8 from Sam James <sam at gentoo dot org> ---
ftr: andreas fixed that part in
https://sourceware.org/git/?p=glibc.git;a=commit;h=464fd8249e8b791248cab7b0e0cd91757435fa9e.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (7 preceding siblings ...)
  2023-08-18  5:01 ` sam at gentoo dot org
@ 2023-08-18  6:19 ` wbx at openadk dot org
  2023-08-18  7:04 ` sam at gentoo dot org
  9 siblings, 0 replies; 11+ messages in thread
From: wbx at openadk dot org @ 2023-08-18  6:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

wbx at openadk dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|WAITING                     |RESOLVED

--- Comment #9 from wbx at openadk dot org ---
thanks. That is working!

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug math/30773] [m68k] busybox awk is broken (lshift.S related)
  2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
                   ` (8 preceding siblings ...)
  2023-08-18  6:19 ` wbx at openadk dot org
@ 2023-08-18  7:04 ` sam at gentoo dot org
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2023-08-18  7:04 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30773

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.39

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-18  7:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-17  6:17 [Bug math/30773] New: [m68k] busybox awk is broken (lshift.S related) wbx at openadk dot org
2023-08-17  7:22 ` [Bug math/30773] " schwab@linux-m68k.org
2023-08-17  9:36 ` wbx at openadk dot org
2023-08-17 10:39 ` schwab@linux-m68k.org
2023-08-17 12:29 ` adhemerval.zanella at linaro dot org
2023-08-17 14:03 ` schwab@linux-m68k.org
2023-08-17 14:09 ` adhemerval.zanella at linaro dot org
2023-08-17 14:35 ` schwab@linux-m68k.org
2023-08-18  5:01 ` sam at gentoo dot org
2023-08-18  6:19 ` wbx at openadk dot org
2023-08-18  7:04 ` sam at gentoo dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).