Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 932841 - dev-lang/ruby-3.2.5 fails to compile on 32-bit: time.c:2325:35: error: passing argument 3 of split_second from incompatible pointer type [-Wincompatible-pointer-types]
Summary: dev-lang/ruby-3.2.5 fails to compile on 32-bit: time.c:2325:35: error: passin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: c99-porting gcc-14-stable
  Show dependency tree
 
Reported: 2024-05-27 10:51 UTC by Agostino Sarubbo
Modified: 2025-02-18 13:20 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,109.89 KB, text/plain)
2024-05-27 10:51 UTC, Agostino Sarubbo
Details
Do not use wrapper intended for type conversion if not type conversion is needed (ruby-3.2-fix-x86-time-int-types.patch,904 bytes, patch)
2025-01-04 09:34 UTC, Anon Emuss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2024-05-27 10:51:11 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-lang/ruby-3.2.4 fails to compile.
Discovered on: x86 (internal ref: tinderbox_x86)
System: GCC-14-SYSTEM (https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#GCC-14)

Info about the issue:
https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0003
Comment 1 Agostino Sarubbo gentoo-dev 2024-05-27 10:51:12 UTC
Created attachment 894509 [details]
build.log

build log and emerge --info
Comment 2 matoro archtester 2024-08-24 00:42:13 UTC
Still on ruby-3.2.5; affects all 32-bit
Comment 3 Hans de Graaff gentoo-dev Security 2024-08-24 08:52:01 UTC
This looks to be fixed in ruby 3.3 and 3.4, but there are significant code changes so there isn't an easy patch to backport.

It might be possible to simply define "s" as a "VALUE" instead of a "wideval_t". That would fix the warning but I don't know the ruby C stuff well enough to determine if there would be additional impact.
Comment 4 konsolebox 2024-08-24 13:48:12 UTC
Seems like the correct way is to use wdivmod instead of split_second as it is already called in many parts of time.c.

-    split_second(tobj->timew, &t, &s);
+    wdivmod(tobj->timew, WINT2FIXWV(TIME_SCALE), &t, &s);

A similar patch has already been made for 3.4 (preview) and already backported to 3.3 as part of a batch of patches:

https://github.com/ruby/ruby/commit/055613fd868a8c94e43893f8c58a00cdd2a81f6d
https://github.com/ruby/ruby/commit/b13cf49036f0a454063cde25807785adc00f8995
Comment 5 konsolebox 2024-08-24 13:50:28 UTC
split_second is just a wrapper.

static void
split_second(wideval_t timew, wideval_t *timew_p, VALUE *subsecx_p)
{
    wideval_t q, r;
    wdivmod(timew, WINT2FIXWV(TIME_SCALE), &q, &r);
    *timew_p = q;
    *subsecx_p = w2v(r);
}
Comment 6 Anon Emuss 2025-01-04 09:34:38 UTC
Created attachment 915818 [details, diff]
Do not use wrapper intended for type conversion if not type conversion is needed

I agree with the proposed fix, and am attaching a patch that implements that fix.  It worked on my build.  Hope it helps.
Comment 8 Larry the Git Cow gentoo-dev 2025-01-05 08:03:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6bf6ca499c08f49ad4879f5c658265f1df6e5b27

commit 6bf6ca499c08f49ad4879f5c658265f1df6e5b27
Author:     Hans de Graaff <graaff@gentoo.org>
AuthorDate: 2025-01-05 08:02:07 +0000
Commit:     Hans de Graaff <graaff@gentoo.org>
CommitDate: 2025-01-05 08:02:07 +0000

    dev-lang/ruby: fix pointer incompatibility on 32-bit
    
    Apply upstream patch to fix this issue. This was already fixed in newer
    ruby versions.
    
    Closes: https://bugs.gentoo.org/932841
    Signed-off-by: Hans de Graaff <graaff@gentoo.org>

 .../3.2/014-time-pointer-incompatibility.patch     |  28 ++
 dev-lang/ruby/ruby-3.2.6-r3.ebuild                 | 291 +++++++++++++++++++++
 2 files changed, 319 insertions(+)