Bug 480563 - [gtk-doc] Mistakenly substitute -1 with G_MAXULONG in x86_64
[gtk-doc] Mistakenly substitute -1 with G_MAXULONG in x86_64
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gtk-doc (Show other bugs)
rawhide
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Matthias Clasen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-18 20:08 EST by Ding-Yi Chen
Modified: 2009-03-09 10:51 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-09 10:51:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ding-Yi Chen 2009-01-18 20:08:44 EST
Description of problem:
When using g_param_spec_int() to specify -1 as the minimum value of int, 
gtk-doc mistakenly substitute -1 with G_MAXULONG in x86_64 machines.


Version-Release number of selected component (if applicable):
gtk-doc-1.10-2

How reproducible:
Always


Steps to Reproduce:
Use a segment of lib/tomoe-query.c from tomoe 
(http://tomoe.sourceforge.jp/cgi-bin/en/blog/index.rb) as example:
    spec = g_param_spec_int ("min_n_strokes",
                             N_("Minimum number of strokes"),
                             N_("Minimum number of strokes of searched "
                                "character."),
                             -1, G_MAXINT32, -1,
                             G_PARAM_READWRITE);

1. Download and extract tomoe-0.6.0.tar.gz
2. cd tomoe-0.6.0
3. autoreconf -vif
4. ./configure --disable-static --enable-gtk-doc
5. make 
6. Open the URL doc/reference/html/TomoeQuery.html
  
Actual results:
Section "The "max-n-strokes" property" in web page shows:

Allowed values: >= G_MAXULONG
Default value: -1


Expected results:
Section "The "max-n-strokes" property" in web page should show:

Allowed values: >= -1
Default value: -1

Additional info:
Other negative number such as -2 does not cause this problem,
and it seems only affecting 64-bit machines.
Comment 1 Matthias Clasen 2009-02-05 15:50:28 EST
G_MAXULONG is not an int value, so that doesn't make much sense to begin with.

Also, the param spec you show is for min-n-strokes, but your complaint seems to be about max-n-strokes...

Can you clarify ?
Comment 2 Ding-Yi Chen 2009-02-05 20:39:20 EST
I have both i386 and x86_64 machines, and the problem only occur in my x86_64.

Following program demonstrate the problem in x86_64:
/* Begin of show64.c */
#include <stdlib.h>
#include <stdio.h>
#include <glib-object.h>

static gchar*
describe_signed_constant (gint64 value)
{
  gchar *desc;
  
  if (value == G_MINLONG)
    desc = g_strdup ("G_MINLONG");
  else if (value == G_MAXULONG)
    desc = g_strdup ("G_MAXULONG");
  else if (value == G_MAXINT64)
    desc = g_strdup ("G_MAXINT64");
  else if (value == G_MININT64)
    desc = g_strdup ("G_MININT64");
  else
    desc = g_strdup_printf ("%" G_GINT64_FORMAT, value);

  return desc;
}

int main(int argc,char *argv[]){
  printf("describe_signed_constant (-1):%s\n",describe_signed_constant (-1));
  return 0;
}
/* End of show64.c*/


Compile it using:
gcc -o show64 show64.c `pkg-config --cflags --libs glib-2.0`

Run it with:
./show64

And the result is:
describe_signed_constant (-1):G_MAXULONG

Where the result should be:
describe_signed_constant (-1):-1

Similar code segement is in code generation part in gtkdoc-scangobj,
specifically, search "describe_signed_constant (gint64 value)" in gtkdoc-scangobj
to see what I am talking about.

Maybe removing unsigned constant in static gchar* describe_signed_constant (gint64 value) 
fix the problem.

Regards,
Ding-Yi Chen
Comment 3 Matthias Clasen 2009-02-20 16:50:17 EST
Filed upstream: http://bugzilla.gnome.org/show_bug.cgi?id=572612
Comment 4 Matthias Clasen 2009-03-09 10:51:53 EDT
Fixed upstream, we'll get the fix with the next upstream release.

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