summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3717.c
blob: feb9fe3005babb1dfc3d5ec389e745dbce2e8d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* bug-3717.c
   A bug in generalized constant propagation-based optimizations' handling of casts to float.
*/

#include <testfwk.h>

unsigned char foo(void) { return 0; } // Return type must be an unsigned char to reproduce bug
int func(float a) { return a; } // Argument type must be a float/double

void
testBug(void)
{
#ifndef __SDCC_pdk14 // Lack of memory
    func(foo() + 0); // Summand literal must be 0 or a floating point (e.g. 1.0)
#endif
}