This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [ping][patch] Fixed-point patch 4/10


Joseph S. Myers wrote:
> 
> >   This error comes from valid user code that tries to operate on
> > mixed data types of integers and fractional types.
> > Ex: 
> > long long a; /* 63 integral bits + a sign bit. */
> > long long _Fract b; /* 63 fractional bits + a sign bit.  */
> > b = a * b; // For this operation (a * b), GCC tries to find 
> an accum mode
> > that can support at least 63 integral bits and 63 fractional bits.
> > But, if the target doesn't have this kind of accum mode, GCC fails.
> 
> It appears to me that the result type in N1169 is to be the 
> fixed-point 
> type (with the specified overflow rules applied) for 
> arithmetic between 
> fixed-point and integer types.
> 
> If the problem here is an internal implementation matter - if 
> you generate 
> the correct result type, but need this other mode for 
> internal arithmetic 
> - then that's a bug in the implementation.  Preferably this 
> bug should be 
> fixed (if the target doesn't have the modes, generate 
> appropriate code 
> using a libgcc function if necessary), but if that is hard 
> then file a PR 
> in Bugzilla, add a comment referencing the PR, and use sorry 
> (), which 
> will output a message starting "sorry, unimplemented: ".

  What you describe is right.  The current implementation may not support
all kinds of mixed integer and fixed-point types.  I will use

      sorry ("GCC cannot support operators with integer types and fixed-point \
types that have too many integral and fractional bits together");

  About the PR, after all patches are checked in, I will file one bug 
for this case.

> 
> >   Maybe I will use this error message.
> > ---
> >       error ("should not use integer types and fixed-point 
> types that have too\
> > \nmany integral and fractional bits together");
> > ---
> > Is it ok?
> 
> Don't put newlines in the middle of messages; just output the 
> message, 
> however long it is, and let the user use options to wrap if 
> it they so 
> wish.
> 
> >   I will change to gcc_assert (0), because these cases 
> should not happen.
> 
> The idiom is gcc_unreachable ().

  Yes.  Thanks!

Regards,
Chao-ying


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]