Switch to a previous version of gcc

The current version of gcc is :

gcc (Clear Linux OS for Intel Architecture) 10.2.1 20210303 releases/gcc-10.2.0-895-g2939b35893

I need an older version 8 or 9 for compiling riscv-toolchain and openocd.
These versions are already installed.
I tryed to export CC and CCX with a new path before ./configure and make, but gcc remains on 10.2.1.
Any help would be appreciated.
Marie

c-extras-gcc9

Hello
I really appreciate your help.
Could you provide more details?
I have already installed c-extras-gcc9 from swupd bundle-add.
How to switch before compiling between gcc10.2.1 to gcc9?
Switching is required only for few applications. Is a backward possible?
Many thanks
Marie

change environment variable cc