diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2022-04-18 16:19:20 +0200 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2022-04-18 16:19:20 +0200 |
commit | 15c99df7bca51d33d6d7d7fe26ad7ce66ebb7ac4 (patch) | |
tree | 880d54f86627e4b1b45a66848e31c5af0da037e8 /mpn | |
parent | d5140b0ec81a64f53f5c3f223fdf215b324675eb (diff) | |
download | gmp-15c99df7bca51d33d6d7d7fe26ad7ce66ebb7ac4.tar.gz |
Do not use mp directly in mpz_class
This is the difference between f and g in the following,
where gcc generates "return 1;" for f and not for g.
The aliasing is caused by the functions get_num and get_den
in mpq_class.
struct mpz_struct { int i; };
typedef mpz_struct mpz_t[1];
struct mpq_struct { mpz_struct num, den; };
typedef mpq_struct mpq_t[1];
struct mpz_class { mpz_t mp; };
struct mpq_class { mpq_t mp; };
int f(mpq_class*q, mpz_class*z){
q->mp->num.i = 1;
z->mp->i = 2;
return q->mp->num.i;
}
int g(mpq_class*q, mpz_class*z){
q->mp->num.i = 1;
int*p=&z->mp->i;
*p = 2;
return q->mp->num.i;
}
Diffstat (limited to 'mpn')
0 files changed, 0 insertions, 0 deletions