Problem with ROFF change in ai/ao

Bug #1991765 reported by Dirk Zimoch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
New
Undecided
Unassigned

Bug Description

In commit ffcbd4ca, ROFF of ai and ao have been changed from LONG to ULONG.
This has caused problems when migrating from EPICS 3.14 to 7.0 in multiple cases where ROFF was negative and thus became a huge positive value.
There seems to be no workaround for this regression.

description: updated
Revision history for this message
Dirk Zimoch (dirk.zimoch) wrote :

I just found that this had been discussed in Tech Talk already:
https://epics.anl.gov/tech-talk/2019/msg00992.php

Revision history for this message
Andrew Johnson (anj) wrote :

The original change (released 7½ years ago) was to properly support 32-bit raw values as you requested in https://epics.anl.gov/tech-talk/2013/msg00684.php but without triggering UB, which modern compiler optimizers love to rely on to break previously-working-but-non-portable code.

ROFF can't hold negative values, it was designed to support ADCs and DACs with an offset zero. If you have device support that was setting a negative ROFF it was depending on overflowing a uint32 calculation, which gcc allows with the -fwrapv flag but EPICS doesn't set that and it isn't portable.

I don't think we can change this in the record types at all, the device support has to provide any fixes necessary IMHO.

Revision history for this message
Dirk Zimoch (dirk.zimoch) wrote :

Hmm… We have a driver that sets ROFF to -512. I’ll need to see how I can modify it. My first attempt was to simply use EOFF instead (properly scaled of course) but that does not work with breakpoint tables. Another case was a user who had set ROFF to a negative value in his template or from another record or something like that (with another driver which does not use ROFF).
I guess we cannot have both, full 32 bit unsigned AND negative values unless ROFF was a double (or 64 bit signed int).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.