On Mon, Oct 17, 2011 at 12:22:03PM +0200, Tobias Burnus wrote: > On 10/15/2011 11:21 PM, Steve Kargl wrote: > >OK for trunk? > > > >2011-10-15 Steven G. Kargl<ka...@gcc.gnu.org> > > > > * gfortran.dg/ishft_3.f90: Update test. > > I am not so happy with complete test replacements. How about adding it > as new test case? >
Well, the old testcase is %cat ishft_3.f90 ! { dg-do compile } program ishft_3 integer i, j write(*,*) ishftc( 3, 2, 3 ) write(*,*) ishftc( 3, 2, i ) write(*,*) ishftc( 3, i, j ) write(*,*) ishftc( 3, 128 ) ! { dg-error "exceeds BIT_SIZE of first" } write(*,*) ishftc( 3, 0, 128 ) ! { dg-error "exceeds BIT_SIZE of first" } write(*,*) ishftc( 3, 0, 0 ) ! { dg-error "Invalid third argument" } write(*,*) ishftc( 3, 3, 2 ) ! { dg-error "exceeds third argument" } end program 1) It's misnamed. There is no testing of ishft. 2) i and j are undefined, so lines 4 and 5 are invalid. Even if i and j were defined, there is nothing special about those lines in that gfortran generates a function call to a runtime routine. Note, this a "dg-do compile" test. 3) The four dg-error strings would need to be updated to the new error messages. The only line that would survive is the first line, which is covered in the updated testcase. > >2011-10-15 Steven G. Kargl<ka...@gcc.gnu.org> > > > > * check.c (less_than_bitsize1): Check|shift| <= bit_size(i). > > (gfc_check_ishftc): Check|shift| <= bit_size(i) and check > > that size is positive. > > I somehow find less_than_bitsize1's > > + if (strncmp (arg2, "ISHFT", 5) == 0) > > not that elegant and would prefer another argument, which tells the > function that it should take the absolute value of the argument; > however, given that ISHFT seems to be the only function which allows > negative arguments, one could also leave it. > In looking at the other uses of less_than_bitsize1() I could pass arg2=NULL for ISHFT[C], and then the code would become if (arg2 == NULL) { /* Special case for ISHFT[C]. */ Would that be better? -- Steve