dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] cscctest/c/expr funcptr5.3err, NONE, 1.1 funcptr5.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] cscctest/c/expr funcptr5.3err, NONE, 1.1 funcptr5.3il, NONE, 1.1 funcptr5.c, NONE, 1.1 funcptr5.err, NONE, 1.1 funcptr5.il, NONE, 1.1 Makefile.am, 1.7, 1.8
Date: Fri, 03 Oct 2003 00:33:50 +0000

Update of /cvsroot/dotgnu-pnet/cscctest/c/expr
In directory subversions:/tmp/cvs-serv13930/c/expr

Modified Files:
        Makefile.am 
Added Files:
        funcptr5.3err funcptr5.3il funcptr5.c funcptr5.err funcptr5.il 
Log Message:


Test case for slightly mismatched function pointer types in calls
to functions like "qsort".


--- NEW FILE: funcptr5.err ---
./funcptr5.c:37: warning: incompatible pointer types

--- NEW FILE: funcptr5.3il ---
.assembly '<Assembly>'
{
        .ver 0:0:0:0
}
.module '<Module>'
.custom instance void OpenSystem.C.MemoryModelAttribute::.ctor(int32) = (01 00 
20 00 00 00 00 00)
.method public static int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') * 'a', float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') * 'b') cil managed 
{
        ldc.i4.1
        ret
        .maxstack 1
} // method compare_pos
.field private static float32 * 'save_array'
.method public static int32 'main'() cil managed 
{
        .locals init    (int32)
        ldtoken 'init-on-demand'
        call    void 
[.library]System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(valuetype
 [.library]System.RuntimeTypeHandle)
        ldc.i4.0
        stloc.0
        ldsfld  float32 * 'save_array'
        ldloc.0
        ldc.i4.4
        ldftn   int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *)
        call    void 'qsort'(void *, unsigned int32, unsigned int32, method 
int32 *(void modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, void 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *) 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsFunctionPointer'))
        ldsfld  float32 * 'save_array'
        ldloc.0
        ldc.i4.4
        ldftn   int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *)
        call    void 'qsort'(void *, unsigned int32, unsigned int32, method 
int32 *(void modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, void 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *) 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsFunctionPointer'))
        ldc.i4.0
        ret
        .maxstack 4
} // method main
.method private static specialname void '.init-0'() cil managed 
{
.custom instance void 
['OpenSystem.C']'OpenSystem.C'.'InitializerAttribute'::'.ctor'() = (01 00 00 00)
        ldc.i4.0
        conv.i
        stsfld  float32 * 'save_array'
        ret
        .maxstack 1
} // method .init-0
.method public static void '.start'(class [.library]System.String[] args) cil 
managed
{
        .entrypoint
        .maxstack       3
        .locals (int32, int8 * *, int8 * *, class [.library]System.Object)
.try { 
        ldarg.0
        ldc.i4.4
        ldloca  0
        call    native int 'OpenSystem.C'.'Crt0'::GetArgV(class 
[.library]System.String[], int32, int32 &)
        stloc.1
        call    native int 'OpenSystem.C'.'Crt0'::GetEnvironment()
        stloc.2
        ldstr "libc32"
        call    void 'OpenSystem.C'.'Crt0'::Startup(class 
[.library]System.String)
        call    int32 '<Module>'::'main'()
        call    void 'OpenSystem.C'.'Crt0'::Shutdown(int32)
        leave   L1
} catch [.library]System.OutOfMemoryException {
        rethrow
} catch [.library]System.Object {
        stloc.3
        ldloc.3
        call    class [.library]System.Object 
'OpenSystem.C'.'Crt0'::ShutdownWithException(class [.library]System.Object)
        throw
}
L1:
        ret
} // method .start

--- NEW FILE: funcptr5.c ---
/*
 * funcptr5.c - Test function pointer usage.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

typedef unsigned int size_t;
typedef int (*__compar_fn_t) (const void *, const void *);
extern void qsort(void *__base, size_t __nmemb, size_t __size,
                                  __compar_fn_t __compar);

int compare_pos(const float *a, const float *b)
{
        return 1;
}

int main()
{
        int num = 0;
        static float *save_array = ((void *)0);
        qsort(save_array, num, sizeof(float),
                  (int (*) (const void *, const void *))compare_pos);
        qsort(save_array, num, sizeof(float), compare_pos);
        return 0;
}

--- NEW FILE: funcptr5.il ---
.assembly '<Assembly>'
{
        .ver 0:0:0:0
}
.module '<Module>'
.custom instance void OpenSystem.C.MemoryModelAttribute::.ctor(int32) = (01 00 
40 00 00 00 00 00)
.method public static int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') * 'a', float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') * 'b') cil managed 
{
        ldc.i4.1
        ret
        .maxstack 1
} // method compare_pos
.field private static float32 * 'save_array'
.method public static int32 'main'() cil managed 
{
        .locals init    (int32)
        ldtoken 'init-on-demand'
        call    void 
[.library]System.Runtime.CompilerServices.RuntimeHelpers::RunClassConstructor(valuetype
 [.library]System.RuntimeTypeHandle)
        ldc.i4.0
        stloc.0
        ldsfld  float32 * 'save_array'
        ldloc.0
        ldc.i4.4
        ldftn   int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *)
        call    void 'qsort'(void *, unsigned int32, unsigned int32, method 
int32 *(void modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, void 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *) 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsFunctionPointer'))
        ldsfld  float32 * 'save_array'
        ldloc.0
        ldc.i4.4
        ldftn   int32 'compare_pos'(float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, float32 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *)
        call    void 'qsort'(void *, unsigned int32, unsigned int32, method 
int32 *(void modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *, void 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsConst') *) 
modopt(['OpenSystem.C']'OpenSystem.C'.'IsFunctionPointer'))
        ldc.i4.0
        ret
        .maxstack 4
} // method main
.method private static specialname void '.init-0'() cil managed 
{
.custom instance void 
['OpenSystem.C']'OpenSystem.C'.'InitializerAttribute'::'.ctor'() = (01 00 00 00)
        ldc.i4.0
        conv.i
        stsfld  float32 * 'save_array'
        ret
        .maxstack 1
} // method .init-0
.method public static void '.start'(class [.library]System.String[] args) cil 
managed
{
        .entrypoint
        .maxstack       3
        .locals (int32, int8 * *, int8 * *, class [.library]System.Object)
.try { 
        ldarg.0
        ldc.i4.8
        ldloca  0
        call    native int 'OpenSystem.C'.'Crt0'::GetArgV(class 
[.library]System.String[], int32, int32 &)
        stloc.1
        call    native int 'OpenSystem.C'.'Crt0'::GetEnvironment()
        stloc.2
        ldstr "libc64"
        call    void 'OpenSystem.C'.'Crt0'::Startup(class 
[.library]System.String)
        call    int32 '<Module>'::'main'()
        call    void 'OpenSystem.C'.'Crt0'::Shutdown(int32)
        leave   L1
} catch [.library]System.OutOfMemoryException {
        rethrow
} catch [.library]System.Object {
        stloc.3
        ldloc.3
        call    class [.library]System.Object 
'OpenSystem.C'.'Crt0'::ShutdownWithException(class [.library]System.Object)
        throw
}
L1:
        ret
} // method .start

--- NEW FILE: funcptr5.3err ---
./funcptr5.c:37: warning: incompatible pointer types

Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/cscctest/c/expr/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile.am 5 Nov 2002 23:57:15 -0000       1.7
--- Makefile.am 3 Oct 2003 00:33:48 -0000       1.8
***************
*** 7,10 ****
--- 7,11 ----
            funcptr3.c \
            funcptr4.c \
+           funcptr5.c \
                ptr1.c \
            ptr2.c





reply via email to

[Prev in Thread] Current Thread [Next in Thread]