bugGNUstep - Bugs: bug #10950, GSFormat with %C, regression...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #10950: GSFormat with %C, regression between 1.3.2 and 1.10.0

Submitted by:  None
Submitted on:  Tue 09 Nov 2004 10:24:13 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Adam Fedor <fedor>
Open/Closed: Closed

Wed 08 Dec 2004 04:23:35 PM UTC, comment #4:

I commited this patch

2004-12-07 Adam Fedor <fedor@gnu.org>

  • Source/GSFormat.m (GSFormat): Assign wchar via var args from an

int (Fixes bug #10950).

Adam Fedor <fedor>
Project AdministratorIn charge of this item.
Fri 03 Dec 2004 03:19:58 AM UTC, comment #3:

It appears that on MingW, wint_t is a short, which is technically allowed. However, it would be promoted to int in va_args. This patch fixes the problem:

Index: Source/GSFormat.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/GSFormat.m,v
retrieving revision 1.32
diff -u -r1.32 GSFormat.m
--- Source/GSFormat.m 1 Nov 2004 08:25:04 -0000 1.32
+++ Source/GSFormat.m 3 Dec 2004 03:15:51 -0000
@@ -993,7 +993,7 @@
break

T (PA_CHAR, pa_char, int); /* Promoted. */
- T (PA_WCHAR, pa_wchar, wint_t);
+ T (PA_WCHAR, pa_wchar, int); /* Sometimes promoted. */
T (PA_INT|PA_FLAG_SHORT, pa_short_int, int); /* Promoted. */
T (PA_INT, pa_int, int);
T (PA_INT|PA_FLAG_LONG, pa_long_int, long int);

Although I wonder if I should be more robust and check to see if wint_t could possibly be larger than an int. I'm also not sure why it worked before, but doesn't work now. Perhaps a change in MingW?

Adam Fedor <fedor>
Project AdministratorIn charge of this item.
Tue 23 Nov 2004 12:03:32 AM UTC, comment #2:

Corrected Category.

Fred Kiefer <FredKiefer>
Project Member
Tue 09 Nov 2004 10:48:04 AM UTC, comment #1:

wrong group. how do i change this to 'base'?

Anonymous
Tue 09 Nov 2004 10:24:13 AM UTC, original submission:

Hi all,

GSFormat causes a crash when used with format "%C".

This is something that used to work with GNUstep 1.3.2 and crashes with GNUstep 1.10.0 using MinGW. It works on OSX.

Using this code (appends an unichar 'A' to a mutable string):

On Mac OS X:

cougar:/tmp fred$ cat AppendUnichar.m
#import <Foundation/Foundation.h>

int main()
{
NSAutoreleasePool *thePool = [[NSAutoreleasePool alloc] init];
NSMutableString *theString = [NSMutableString string];

[theString appendFormat:@"%C", (unichar)0x41];

NSLog( @"[%@]", theString );

[thePool release];

return 0;
}

cougar:/tmp fred$ cc -o AppendUnichar -framework Cocoa AppendUnichar.m
cougar:/tmp fred$ ./AppendUnichar
2004-10-26 18:37:35.982 AppendUnichar[766] [A]

cougar:/tmp fred$

On GNUstep 1.3.2 on mingw, with gcc 3.2:

fred@FLEA /c/tmp/AppendUnichar
$ shared_obj/ix86/mingw32/gnu-gnu-gnu/AppendUnichar.exe
2004-10-26 18:44:03.988 AppendUnichar.exe[2020] [A]

fred@FLEA /c/tmp/AppendUnichar

On GNUstep 1.10.0:

AppendUnichar.e caused an Access Violation at location 6de58669 in
module gnustep-base_d.dll Reading from location ffffffff.

Registers:
eax=0022e7e0 ebx=00000000 ecx=0022e7e0 edx=00000002 esi=00000108
edi=0022e060
eip=6de58669 esp=0022e7d0 ebp=0022f718 iopl=0 nv up ei pl zr na
po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000
efl=00000246

Call stack:
6DE58669 gnustep-base_d.dll:6DE58669 GSFormat GSFormat.m:985
...

T (PA_CHAR, pa_char, int); /* Promoted. */

> T (PA_WCHAR, pa_wchar, wint_t);

T (PA_INT|PA_FLAG_SHORT, pa_short_int, int); /* Promoted. */
T (PA_INT, pa_int, int);
...

6DE69D71 gnustep-base_d.dll:6DE69D71 i_GSMutableString__appendFormat
GSString.m:2803
...
#endif
}

> GSFormat((GSStr)self, fmt, ap, nil);

_flags.hash = 0;// Invalidate the hash for this string.
if (fmt != buf)
...

004013AE AppendUnichar.exe:004013AE main AppendUnichar.m:8
...
NSMutableString *theString = [NSMutableString string];

> [theString appendFormat:@"%C", (unichar)0x41];


NSLog( @"[%@]", theString );
...

0040122D AppendUnichar.exe:0040122D
00401258 AppendUnichar.exe:00401258
7C581AF6 KERNEL32.dll:7C581AF6 GetVolumeInformationA

Of course, there are plenty of workarounds, but I definitely don't understand what is going on there in GSFormat.m

Thanks for all the great work you all do on GNUstep,

--andre

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 5 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Wed 08 Dec 2004 04:23:35 PM UTCfedorStatusNone=>Fixed
  Open/ClosedAnalyzed=>Closed
Fri 03 Dec 2004 03:19:58 AM UTCfedorAssigned toNone=>fedor
  Open/ClosedOpen=>Analyzed
Tue 23 Nov 2004 12:03:31 AM UTCFredKieferCategoryMakefiles=>Base/Foundation

Back to the top


Powered by Savane 3.1-cleanup1