C glitch, might be compiler?

I have this piece of code that runs just well on some compilers but on my uni linux machine it has an interesting bug. It is a simple code and I've done more complicated ones, but the fact is that if I input -10 and -8, it enters an if it should not, where it checks if the product is lower or equal to 0(in the product function)

As I said, if I run it on my personal laptop with a newer gcc(the machine's one is gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) , might that be an issue, can't think of anything else), it outputs just fine. Asked one of my cs lecturers and he can't think of a reason either

The problem is that on an 64-bit build, using %i to read a long int, or to print one, leads to undefined behaviour. The correct format is %li. (On a 32-bit build, you can often 'get away' with the format mismatch, and IIRC, older versions of GCC did not even warn you about it — but GCC 6.2.0 does warn about the mismatch. Whether the compiler warns or not, it is still a problem.)

The <<< '-10 -8' is Bash speak to enter the two numbers on the program's standard input. Note the printing in lots of places with the correct format specifier. Your code wouldn't compile with my default compiler options — in part because of the format mismatches (output shown for a copy of your code in pd73.c):

The first warning is semi-acceptable; I'd not complain about it though code I write wouldn't generate it. The static is one way to remove it. Since no other source file needs the function, it can be made static. It means the optimizer can optimize more, too. The alternative is to include a prototype declaration for the function before it is defined. As the error message says, that's due to the -Wmissing-prototypes warning flag.