There is a entity with 32 bit integers and the simulations on active-hdl student edition works fine. On Quartus however, I see that the port sizes are 5 which is shown as [4..0]. Please see the picture which I highlighted that.
Code:
package types is
constant bitWidth: integer := 32;
end;
entity cmp is
port (x, y: in integer range 0 to bitWidth-1;
s, b: out integer range 0 to bitWidth-1);
end;
You don't seem to understand that you have defined the range of x, y, s, and b as 0 to 31. So the values of x, y, s, and b can only be 0-31 which means they only need to be 5-bits wide, i.e. 00000-11111.
The constant being named bitWidth is poorly named. It's more of a endOfRange or maxValue, etc.