Bug 47118 - ICE on incorrect parameter to @synchronized()
Summary: ICE on incorrect parameter to @synchronized()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: objc (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-29 15:20 UTC by Nicola Pero
Modified: 2010-12-30 22:07 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.6.0
Known to fail:
Last reconfirmed: 2010-12-29 15:21:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Pero 2010-12-29 15:20:53 UTC
Here is a testcase that crashes GCC 4.6 --

typedef struct { float x; float y; } point;

int test (id object)
{
  point x;
  @synchronized (x)
    {
      return 1;
    }
}

The compiler is not checking the type of the argument of @synchronized() and is not dealing with unexpected types correctly.

Thanks
Comment 1 Nicola Pero 2010-12-29 15:21:12 UTC
Confirmed on trunk, 29 December 2010.

Thanks
Comment 2 Nicola Pero 2010-12-29 21:52:03 UTC
Author: nicola
Date: Wed Dec 29 21:52:00 2010
New Revision: 168326

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168326
Log:
In gcc/objc/:
2010-12-29  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR objc/47118
	* objc-act.c (objc_build_synchronized): Check the argument of
	@synchronized and emit an appropriate error if it is not a valid
	Objective-C object.  Deal gracefully with that case.  Updated
	comments and variable names.

In gcc/testsuite/:
2010-12-29  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR objc/47118
	* objc.dg/sync-3.m: New.
	* obj-c++.dg/sync-3.mm: New.


Added:
    trunk/gcc/testsuite/obj-c++.dg/sync-3.mm
    trunk/gcc/testsuite/objc.dg/sync-3.m
Modified:
    trunk/gcc/objc/ChangeLog
    trunk/gcc/objc/objc-act.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Nicola Pero 2010-12-30 22:07:26 UTC
Fixed in trunk.

Thanks