After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 563469 - Arrays not treated correctly in struct offset calculation
Arrays not treated correctly in struct offset calculation
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 568680
 
 
Reported: 2008-12-06 16:56 UTC by Andreas Rottmann
Modified: 2015-02-07 16:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes offset calculation for arrays (5.99 KB, patch)
2008-12-06 17:22 UTC, Andreas Rottmann
none Details | Review
Fixes array offset calculation (5.95 KB, patch)
2009-01-03 13:44 UTC, Andreas Rottmann
reviewed Details | Review

Description Andreas Rottmann 2008-12-06 16:56:26 UTC
Arrays are currently not handled specially, and hence treated as pointers in giroffsets.c:get_field_size_alignment(), which is (obviously) wrong.
Comment 1 Owen Taylor 2008-12-06 16:57:53 UTC
Is the subject here constant length arrays? Is the length of such arrays
in the scanner information?
Comment 2 Andreas Rottmann 2008-12-06 17:22:11 UTC
Created attachment 124060 [details] [review]
Fixes offset calculation for arrays
Comment 3 Andreas Rottmann 2009-01-03 13:44:59 UTC
Created attachment 125679 [details] [review]
Fixes array offset calculation

Rebased patch against SVN r996.
Comment 4 Johan (not receiving bugmail) Dahlin 2009-01-13 21:19:51 UTC
I'm not too familiar with this code.
Owen, could you help out here?
Comment 5 Owen Taylor 2009-01-15 19:09:00 UTC
It looks pretty good to me.

The only thing I am wondering about - is

 type->is_pointer && type->tag == GI_TYPE_TAG_ARRAY

possible? How would a guchar** (strv) in a structure be represented?
Comment 6 Andreas Rottmann 2009-01-23 10:43:57 UTC
(In reply to comment #5)
> It looks pretty good to me.
> 
> The only thing I am wondering about - is
> 
>  type->is_pointer && type->tag == GI_TYPE_TAG_ARRAY
> 
> possible? How would a guchar** (strv) in a structure be represented?
> 
AFAICT, this case is not currently handled by the scanner, you get just a plain "any" as type in the GIR for pointer-to-pointer types, but that's a least correct wrt. alignment and offsets. I'd say this (lack of proper type info in GIR/typelib for pointer-to-pointer types) is a different bug.
Comment 7 Colin Walters 2009-02-02 16:32:27 UTC
Applied, thank you! pointer-to-pointer is something we need to figure out for correct support for some unions and more, but this patch looks good as is.
Comment 8 André Klapper 2015-02-07 16:54:43 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]