RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1225995 - ppc64le: ocaml calls from ocaml to C fail with more than 8 parameters
Summary: ppc64le: ocaml calls from ocaml to C fail with more than 8 parameters
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ocaml
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Václav Kadlčík
URL:
Whiteboard:
Depends On:
Blocks: 1224675 1224676
TreeView+ depends on / blocked
 
Reported: 2015-05-28 17:07 UTC by Richard W.M. Jones
Modified: 2015-11-19 04:49 UTC (History)
5 users (show)

Fixed In Version: ocaml-4.01.0-22.5.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 04:49:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
call.ml (1.28 KB, text/plain)
2015-05-28 17:07 UTC, Richard W.M. Jones
no flags Details
print.c (4.74 KB, text/plain)
2015-05-28 17:08 UTC, Richard W.M. Jones
no flags Details
Makefile (140 bytes, text/plain)
2015-05-28 17:08 UTC, Richard W.M. Jones
no flags Details
Makefile (227 bytes, text/plain)
2015-05-28 18:11 UTC, Richard W.M. Jones
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2185 0 normal SHIPPED_LIVE ocaml bug fix update 2015-11-19 08:07:24 UTC

Description Richard W.M. Jones 2015-05-28 17:07:01 UTC
Description of problem:

The OCaml compiler on ppc64le miscompiles calls from OCaml to C which
have more than 8 parameters.

The example program prints:

$ ./test
-1
-1 -2
-1 -2 -3
-1 -2 -3 -4
-1 -2 -3 -4 -5
-1 -2 -3 -4 -5 -6
-1 -2 -3 -4 -5 -6 -7
-1 -2 -3 -4 -5 -6 -7 -8
-1 -2 -3 -4 -5 -6 -7 -8 0
-1 -2 -3 -4 -5 -6 -7 -8 0 70366595657576
                        ^^^^^
                        note incorrect values here

Version-Release number of selected component (if applicable):

ocaml-4.01.0-22.4.ael7b.ppc64le

How reproducible:

100%

Steps to Reproduce:
1. Save the attached files into a directory.
2. Type 'make'
3. Type './test'

Comment 1 Richard W.M. Jones 2015-05-28 17:07:54 UTC
Created attachment 1031348 [details]
call.ml

Comment 2 Richard W.M. Jones 2015-05-28 17:08:16 UTC
Created attachment 1031349 [details]
print.c

Comment 3 Richard W.M. Jones 2015-05-28 17:08:33 UTC
Created attachment 1031350 [details]
Makefile

Comment 4 Richard W.M. Jones 2015-05-28 17:11:42 UTC
On x86-64 the output is as expected:

$ ./test 
-1
-1 -2
-1 -2 -3
-1 -2 -3 -4
-1 -2 -3 -4 -5
-1 -2 -3 -4 -5 -6
-1 -2 -3 -4 -5 -6 -7
-1 -2 -3 -4 -5 -6 -7 -8
-1 -2 -3 -4 -5 -6 -7 -8 -9
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10

Comment 6 Richard W.M. Jones 2015-05-28 18:06:59 UTC
The bug does NOT occur on ppc64 big endian
(I tested ocaml-4.01.0-22.2.el7.ppc64).

Comment 7 Richard W.M. Jones 2015-05-28 18:11:07 UTC
Created attachment 1031359 [details]
Makefile

Improved Makefile - adds a 'make clean' rule and enables -g option.

Comment 8 Richard W.M. Jones 2015-05-28 18:11:58 UTC
Stack trace for a call with 10 parameters:

#0  args10 (i1v=268699820, i2v=268699844, i3v=268699868, i4v=268699892, 
    i5v=268699916, i6v=268699940, i7v=268699964, i8v=268699988, 
    i9v=70368744172768, i10v=70367536164736) at print.c:179
#1  0x000000001001c734 in caml_c_call ()
#2  0x0000000010002b0c in camlCall__entry ()
#3  0x00000000100022f0 in caml_program ()
#4  0x000000001001c8b8 in caml_start_program ()
#5  0x000000001001cff8 in caml_main ()
#6  0x000000001000209c in main ()

Comment 9 Richard W.M. Jones 2015-05-28 20:13:08 UTC
Fix is:

diff --git a/asmcomp/power64le/proc.ml b/asmcomp/power64le/proc.ml
index 9b98577..30d4cdc 100644
--- a/asmcomp/power64le/proc.ml
+++ b/asmcomp/power64le/proc.ml
@@ -188,7 +188,7 @@ let poweropen_external_conventions first_int last_int
 let loc_external_arguments =
   match Config.system with
   | "rhapsody" -> poweropen_external_conventions 0 7 100 112
-  | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 48
+  | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 32
   | _ -> assert false
 
 let extcall_use_push = false

Comment 10 Richard W.M. Jones 2015-05-28 20:22:40 UTC
Could I have QA ack on this bug please.

Comment 11 Hu Zhang 2015-05-29 09:23:26 UTC
Reproduced this bug with 
ocaml-4.01.0-22.4.ael7b.ppc64le
kernel-3.10.0-244.ael7b.ppc64le

Reproduce step:
1. get the attachments.
2. # make
   # ./test
-1
-1 -2
-1 -2 -3
-1 -2 -3 -4
-1 -2 -3 -4 -5
-1 -2 -3 -4 -5 -6
-1 -2 -3 -4 -5 -6 -7
-1 -2 -3 -4 -5 -6 -7 -8
-1 -2 -3 -4 -5 -6 -7 -8 0
-1 -2 -3 -4 -5 -6 -7 -8 0 70366973604056

Comment 14 Richard W.M. Jones 2015-06-02 13:29:32 UTC
Test case looks good, thanks.

Comment 17 errata-xmlrpc 2015-11-19 04:49:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2185.html


Note You need to log in before you can comment on or make changes to this bug.