This is the mail archive of the gcc@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]

Can GMP be replaced by trees?



With Toon's recent remark about how incorrect rounding due to excess precision in our frontend may corrupt results, and Steve's work which revealed several minor mistakes in the GMP code in arith.c, I started wondering if our dependency on GMP can be removed.


The reason we have the dependency on GMP in our frontend is two-fold:
1. storing constants with machine-independent precision
2. folding constant expressions with machine-independent precision and without loss of precision
both are of course related to the problem of cross-compilation and reliable results across architectures.


Now AFAIK gcc already has these mechanisms implemented: trees for storing values, fold_const for simplifying expressions. If these didn't work well, gcc wouldn't be usable as a cross-compiler. I don't know if they work well enough for us, but I'm inclined to believe they do.

How difficult would it be to change gfortran to use gcc's mechanisms instead? I don't know. I suppose the easiest way is to create a pseudo-GMP interface which resembles GMP as much as possible and does everything on trees, and then incrementally replace existing code which uses these interfaces to either a simplified interface to these operations, or to operations directly manipulating trees.

Does anybody else -- especially people who know gcc's trees not only superficially like I do -- think this is a worthy project? Is there anything GMP gives us that trees wouldn't?

I understand that our priorities should be different currently, but if we decide to do this, I think we should plan to do this before a release, so that we never introduce a dependency on GMP in the real world.

Thanks,
- Tobi


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