[cfe-commits] r46472 - in /cfe/trunk: AST/ASTContext.cpptest/Sema/function.c

Nuno Lopes nunoplopes at sapo.pt
Tue Jan 29 12:10:35 PST 2008


Thank you!
Nuno

P.S.: today I've filled a few more bugs for your delight (some with patch) 
:P


----- Original Message -----
> r46522 fixes the issue below.
>
> Thanks,
>
> snaroff
>
> On Jan 29, 2008, at 6:45 AM, Steve Naroff wrote:
>
>> This is definitely a bug.
>>
>> I started looking into this yesterday (I discovered it while fixing 
>> bz1950 for you:-) Unlike bz1950, the precise location of the fix is  a 
>> little troublesome. I believe the fix is to 
>> ASTContext::typesAreCompatible(), however this causes some tests to  fail 
>> (which will take some time to track down).
>>
>> Thanks,
>>
>> snaroff
>>
>> On Jan 29, 2008, at 4:56 AM, Nuno Lopes wrote:
>>
>>> Hi,
>>>
>>> Please consider the following:
>>>
>>> $ gcc -fsyntax-only a.c
>>> a.c:2: error: conflicting types for 'a'
>>> a.c:1: error: previous declaration of 'a' was here
>>>
>>> $ gcc -fsyntax-only -std=c99 a.c
>>> a.c:2: error: conflicting types for 'a'
>>> a.c:1: error: previous declaration of 'a' was here
>>>
>>> $ ../../Debug/bin/clang -fsyntax-only a.c
>>>
>>> $ cat a.c
>>> void a(char*);
>>> void a(const char*);
>>>
>>> $ gcc --version
>>> gcc (GCC) 4.1.2 (Gentoo 4.1.2)
>>> Copyright (C) 2006 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.   There is 
>>> NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
>>> PURPOSE.
>>>
>>>
>>> I don't have the standard at home (we have only 1 copy in the 
>>> university..), but at least gcc disagrees with clang.
>>>
>>> Nuno
>>>
>>>
>>> ----- Original Message ----- From: "Steve Naroff" <snaroff at apple.com>
>>> To: <cfe-commits at cs.uiuc.edu>
>>> Sent: Tuesday, January 29, 2008 12:15 AM
>>> Subject: [cfe-commits] r46472 - in /cfe/trunk: AST/ 
>>> ASTContext.cpptest/Sema/function.c
>>>
>>>
>>>> Author: snaroff
>>>> Date: Mon Jan 28 18:15:50 2008
>>>> New Revision: 46472
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=46472&view=rev
>>>> Log:
>>>>
>>>> Fix bz1950. ASTContext::functionTypesAreCompatible() needs to  operate 
>>>> on the unqualified parameter types (per C99 6.7.5.3p15).
>>>>
>>>>
>>>> Modified:
>>>>  cfe/trunk/AST/ASTContext.cpp
>>>>  cfe/trunk/test/Sema/function.c
>>>>
>>>> Modified: cfe/trunk/AST/ASTContext.cpp
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=46472&r1=46471&r2=46472&view=diff
>>>>
>>>> = = = = = = = = = = 
>>>> ====================================================================
>>>> --- cfe/trunk/AST/ASTContext.cpp (original)
>>>> +++ cfe/trunk/AST/ASTContext.cpp Mon Jan 28 18:15:50 2008
>>>> @@ -1579,7 +1579,10 @@
>>>>
>>>>   // The use of ellipsis agree...now check the argument types.
>>>>   for (unsigned i = 0; i < lproto_nargs; i++)
>>>> -      if (!typesAreCompatible(lproto->getArgType(i), rproto-
>>>> >getArgType(i)))
>>>> +   // C99 6.7.5.3p15: ...and each parameter declared with  qualified 
>>>> type
>>>> +   // is taken as having the unqualified version of it's declared 
>>>> type.
>>>> +      if (!typesAreCompatible(lproto-
>>>> >getArgType(i).getUnqualifiedType(),
>>>> +                           rproto-
>>>> >getArgType(i).getUnqualifiedType()))
>>>>       return false;
>>>>   return true;
>>>> }
>>>>
>>>> Modified: cfe/trunk/test/Sema/function.c
>>>> URL: 
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=46472&r1=46471&r2=46472&view=diff
>>>>
>>>> = = = = = = = = = = 
>>>> ====================================================================
>>>> --- cfe/trunk/test/Sema/function.c (original)
>>>> +++ cfe/trunk/test/Sema/function.c Mon Jan 28 18:15:50 2008
>>>> @@ -3,6 +3,9 @@
>>>> void f(double a[restrict][5]);  // should promote to restrict ptr.
>>>> void f(double (* restrict a)[5]);
>>>>
>>>> +int foo (__const char *__path);
>>>> +int foo(__const char *__restrict __file);
>>>> +
>>>> void g(int (*)(const void **, const void **));
>>>> void g(int (*compar)()) {
>>>> }
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits 




More information about the cfe-commits mailing list