← Back to team overview

kernel-packages team mailing list archive

[Bug 1407521] Re: C compiler bcc struct passing fails

 

Attached a short program which can be compiled in order to see the
problem. Compile with

  bcc -ansi -S struct_pass.c

Then scroll down the resulting assembly file struct_pass.s to get past
the comments. On my system the errant code began at line 235.


** Attachment added: "Source code struct_pass.c to help show the bug"
   https://bugs.launchpad.net/ubuntu/+source/linux86/+bug/1407521/+attachment/4292104/+files/struct_pass.c

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux86 in Ubuntu.
https://bugs.launchpad.net/bugs/1407521

Title:
  C compiler bcc struct passing fails

Status in linux86 package in Ubuntu:
  New

Bug description:
  C compiler bcc copies structs and returns structs correctly but fails
  to pass them to functions. From checking it turns out that the
  generated code calls _memcpy with the wrong parameters. For example,
  this is the generated assembly which should pass a 6-byte struct to a
  function.

  ! Debug: list struct composite original = [S+$14-$C] (used reg = )
  add     sp,*-6
  mov     ax,sp     <--- presumably the target address
  mov     ax,*6   <--- gets overwritten by the size of the struct
  push    ax     <--- push the size of the struct
  lea     bx,-$A[bp]
  push    bx     <--- push the source address
  push    ax     <--- should be the target address
  call    _memcpy
  add     sp,*6

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: bcc 0.16.17-3.1ubuntu3
  ProcVersionSignature: Ubuntu 3.13.0-30.54-generic 3.13.11.2
  Uname: Linux 3.13.0-30-generic i686
  ApportVersion: 2.14.1-0ubuntu3.2
  Architecture: i386
  Date: Sun Jan  4 22:58:22 2015
  ProcEnviron:
   SHELL=/bin/bash
   TERM=ansi
   PATH=(custom, user)
   LANG=en_GB.utf8
   XDG_RUNTIME_DIR=<set>
  SourcePackage: linux86
  UpgradeStatus: Upgraded to trusty on 2014-06-20 (198 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux86/+bug/1407521/+subscriptions


References