small/wrong type used for processing integer constants
Submitted by Vratislav Podzimek
Link to original bug (#758693)
Description of problem
When there is a big numeric constant (macro) defined in the code, g-ir-scanner uses too small/wrong type to process it and puts an overflown value in the .gir file. (example code attached)
Version-Release number of selected component (if applicable):
gobject-introspection-devel-1.42.0-1.fc21.x86_64
How reproducible
100 %
Steps to Reproduce
- compile and scan the test_data.c and test_data.h files
- check the resulting TestData-1.0.gir file for the TEST_DATA_CONST1
- compile and run the following simple test to get the TEST_DATA_CONST1 constant value from C:
#include <glib.h>
#include "test_data.h"
#include <stdio.h>
int main (int argc, char **argv) {
printf ("%"G_GUINT64_FORMAT, get_const1());
return 0;
}
Actual results
<constant name="DATA_CONST1"
value="-9223372036854775808"
c:type="TEST_DATA_CONST1">
<type name="gint" c:type="gint"/>
</constant>
in the TestData-1.0.gir file and 9223372036854775808 printed by the testing C code.
Expected results
9223372036854775808 in both places
Additional info
what may seem to be a crazy number is actually a constant giving the max LV size on 64bit systems in bytes (8 EiB)
Attachment 316291, "the reproducer sources":
reproducer.tar.gz
Edited by Emmanuele Bassi